Compare two mysql dumps
git diff --word-diff=color dump1.sql dump2.sql | less -R
Answer taken from here: https://stackoverflow.com/a/57164008
git diff --word-diff=color dump1.sql dump2.sql | less -R
Answer taken from here: https://stackoverflow.com/a/57164008
The quick way:
git branch --merged master | grep -v '^[ *]*master$' | xargs git branch -d
git remote prune origin
Use the following to have the branches displayed before you’re asked to delete them.
branches=$(git branch --merged master | grep -v '^[ *]*master$'); \
printf '\n\nBranches to be removed:\n---\n'; \
echo ${branches} | xargs -n1; \
printf '---\n\nRemove the branches above? [Ny] ' \
&& read shouldDelete \
&& [[ "${shouldDelete}" =~ [yY] ]] \
&& echo $branches | xargs git branch -d \
|| echo 'aborted'
In your migration, add this as an option to the table:
$this->table(
'specific_costs_users',
['collation'=>'utf8mb4_unicode_ci']
)
->addColumn(...)
I found the answer here on StackOverflow
I noticed today that my server was very slow. Looking at the running processes, I noted that process wanwakuang and 000000 were going crazy.

Searching wanwakuang on Google did not yield much results, but this article on HackerNews was very helpful: https://translate.google.com/translate?sl=auto&tl=en&u=http://hackernews.cc/archives/34789
Appearently wanwakuang is a mining process.
However, I could not find the binary on my system. My server is only running Docker containers, so probably one of the containers was at fault.
To find the docker container with the exploit, I executed the command:
$ find /var/lib/docker -type f -name wanwakuang /var/lib/docker/overlay2/1752e86653539d82b50cf24c3d3f69b203fe059ca1650447016ca69033d468bf/diff/root/.configrc/a/wanwakuang /var/lib/docker/overlay2/1752e86653539d82b50cf24c3d3f69b203fe059ca1650447016ca69033d468bf/diff/tmp/.W10-unix/.rsync/a/wanwakuang /var/lib/docker/overlay2/1752e86653539d82b50cf24c3d3f69b203fe059ca1650447016ca69033d468bf/merged/root/.configrc/a/wanwakuang /var/lib/docker/overlay2/1752e86653539d82b50cf24c3d3f69b203fe059ca1650447016ca69033d468bf/merged/tmp/.W10-unix/.rsync/a/wanwakuang
To find out which Docker container was attached to this overlay, I issued this command I found on stackoverflow:
$ docker inspect $(docker ps -qa) \ | jq -r 'map([.Name, .GraphDriver.Data.MergedDir]) \ | .[] | "(.[0])\t(.[1])"' \ | grep '1752e86653539d82b50cf24c3d3f69b203fe059ca1650447016ca69033d468bf'
Knowing the name I could terminate the container. It was being used for SSH and could be removed.
I had the issue of cronjobs not working (correctly) on my Docker instances.
This is what I did to fix it:
chmod 0600 /etc/cron.d/cronjobchown root /etc/cron.d/cronjobWhen it failed, I could not find the logs of why it failed.
In order to see the output of the failed cronjobs, I installed postfix (because the output of cronjobs is being mailed) and I installed rsyslog
apt-get update; apt-get install -y postfix; mkfifo /var/spool/postfix/public/pickup; service postfix restartrsyslog:apt-get update; apt-get install -y rsyslog; rsyslogd &Now, whenever a cronjob failed, I could find output in either two locations:
/var/log/syslog/var/mail/rootYou need to configure CakePHP to create the cachefiles with the right permissions.
You do this with setting 'mask' => 0666 in file app.php for the Cache setting:
// file src/config/app.php (AND app.default.php!)
...
/**
* Configure the cache adapters.
*/
'Cache' => [
'default' => [
'className' => 'Cake\Cache\Engine\FileEngine',
'path' => CACHE,
'url' => env('CACHE_DEFAULT_URL', null),
'mask' => 0666,
],
...
'_cake_core_' => [
'mask' => 0666,
...
],
'_cake_model_' => [
'mask' => 0666,
...
],
'_cake_routes_' => [
'mask' => 0666,
...
],
...
Most probably:
To fix the above:
service cron start
chmod 0600 /etc/cron.d/<your file>
chown root /etc/cron.d/<your file>
# or maybe you need to set the crontab
crontab /etc/crontabs/root
If that does not work, install rsyslog on your container and debug:
apt-get update; apt-get install -y rsyslog
rsyslogd
Now keep track of your /var/log/syslog file. It will log all issues it receives from cron.
I found the answer here: https://stackoverflow.com/a/33734915
I fixed this by adding <base href="/" /> in the <head> of file /public/index.html:
<!DOCTYPE html>
<html lang="en">
<head>
<base href="/" /
....
That’s an easy and quick think to do!
sudo apt update
sudo apt install docker.io
# start docker now, and on system reboot
sudo systemctl start docker
sudo systemctl enable docker
# check the version
docker --version
Docker version 19.03.8, build afacb8b7f0
Don’t forget to add your user to the docker group, otherwise you’ll get permission denied errors
docker ps
Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock: Get http://%2Fvar%2Frun%2Fdocker.sock/v1.40/containers/json: dial unix /var/run/docker.sock: connect: permission denied
To add your account to the docker group:
sudo usermod -a -G docker paul
Don’t forget to logout and login again!
The full error:
This expression is not callable. Not all constituents of type 'boolean | (() => void)' are callable. Type 'false' has no call signatures. TS2349
This is the code that was triggering the error:
export const useLoading = (defaultValue: boolean = false) => {
const [loading, setLoading ] = useState(defaultValue)
const startLoading = () => setLoading(true)
const stopLoading = () => setLoading(false)
return [
loading,
startLoading,
stopLoading
]
}
CAUSE: the return of the array. Having arrays without a specific type gave me this error as wel: Line 0: Parsing error: : Cannot read property ‘map’ of undefined. The solution was to typehint the array.
SOLUTION: don’t return the array just like that, add ‘as const` at the end of that return statement.
export const useLoading = (defaultValue: boolean = false) => {
const [loading, setLoading ] = useState(defaultValue)
const startLoading = () => setLoading(true)
const stopLoading = () => setLoading(false)
return [
loading,
startLoading,
stopLoading
] as const
}
This is the post that showed me where to find it: https://github.com/microsoft/TypeScript/issues/35423