This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin | |
*/5 * * * * /path/to/job/to/run/every/five/minutes | |
0 9 * * * /path/to/job/to/run/every/day/at/9am | |
0 9 * * * . /source/doesnt/work/so/use/dot/script.sh | |
0 9 * * * /path/script.sh >> /var/log/output_and_errors.log 2>&1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download copy of database from remote host | |
mongodump --host mongo.hostname.com --db database-name --port 27017 --username user --password pwd --out /opt/backup/mongodump | |
# Restore copy of database to remote host | |
mongorestore --host mongo.hostname.com --db database-name --port 27017 --username user --password pwd /opt/backup/mongodump/database-name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
xattr -rc ./*.png |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location / { | |
try_files $uri $uri/ /index.html; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT IN tablename (id, val1, val2) VALUES (1, 'a', 'b') | |
ON DUPLICATE KEY UPDATE val1 = 'a', val2 = 'b'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
docker run --detach --name instance-of-mysql -p 3306 -e MYSQL_ROOT_PASSWORD=secretPw -d mysql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const isObject = item => item && typeof item === 'object' && !Array.isArray(item); | |
const path = ([...paths], obj) => { | |
const tmp = obj[paths.shift()]; | |
return !isObject(tmp) || !paths.length ? tmp : path(paths, tmp); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const pick = (props, obj) => props.reduce((acc, curr) => ({ ...acc, ...{[curr]: obj[curr]} }), {}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// returns a string. fixed is an optional boolean flag to switch on fixed precision or not. | |
// If you want a number instead of a string prepend the unary plus operator, but then fixed precision cannot be guaranteed. | |
// -0.1 * 0.2 === -0.020000000000000004 | |
// round(-0.1 * 0.2, 3, true) === "-0.020" | |
// round(-0.1 * 0.2, 3) === "-0.02" | |
// +round(-0.1 * 0.2, 3) === -0.02 | |
// +round(-0.1 * 0.2, 3, true) === -0.02 | |
const round = (value, decimals, fixed) => { | |
const r = Number(Math.round(value + 'e' + decimals) + 'e-' + decimals) | |
return fixed ? r.toFixed(decimals) : r + '' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const build = path => path.reduceRight((o, i) => Object.assign({}, {[i]: o}), {}) |