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
# using the bwlimit parameter, you can limit the tx speed | |
rsync -r --progress --bwlimit=100 folder folder2 |
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
var array1 = [{id: 1}, {id: 2}, {id: 3}]; | |
var array2 = [{id: 2}, {id: 4}]; | |
var array1Converted = []; | |
var array2Converted = []; | |
// array met JSON objects omzetten tot normale arrays | |
array1.map(el => array1Converted.push(el.id)); | |
array2.map(el => array2Converted.push(el.id)); |
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
var array1 = [1,2,3]; | |
var array2 = [4,5,6]; | |
// eval https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval | |
console.log(eval('array'+'2')) |
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
sed '/^$/d' file.csv > file_clean.csv |
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
CREATE DEFINER=`root`@`%` FUNCTION `REPLACE_SYMBOLS_WITH_TEXT`(field text) RETURNS text CHARSET utf8mb4 | |
RETURN REPLACE(REPLACE(field, '!', '[uitroepteken]'), '#', '[hashtag]') |
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
var fields = [ | |
"name", | |
"lastname" | |
] | |
var rules = { | |
"!": "[uitroepteken]", | |
"#": "[hashtag]", | |
} |
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
Value1=$(TZ=Europe/Amsterdam date "+%F %H:%M:%S") | |
Value2=$(TZ=America/Paramaribo date "+%F %H:%M:%S") | |
Difference=$(($(date -d "$Value1" '+%s') - $(date -d "$Value2" '+%s'))) | |
expr $Difference / 3600 |
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
function dateWithTimeZone(timeZone, year, month, day, hour, minute, second) { | |
var date = new Date(Date.UTC(year, month, day, hour, minute, second)); | |
var utcDate = new Date(date.toLocaleString('en-US', { timeZone: "UTC" })); | |
var tzDate = new Date(date.toLocaleString('en-US', { timeZone: timeZone })); | |
var offset = utcDate.getTime() - tzDate.getTime(); | |
date.setTime( date.getTime() + offset ); | |
return date; |
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
#!/bin/bash | |
# find $1 -maxdepth 1 -name "*.jpg" => finds JPG images in the directory you give it (based on the $1 value) that the script is in | |
# $1 is the directory you give the script for example "./resize_image.sh /home/folder_to_optimize/" | |
for file in `find $1 -maxdepth 1 -name "*.jpg"` | |
do | |
# convert the image and replace the original one | |
# throttle 50 = only use 50% of the cpu power | |
# 2500x = max 2500px, height will be automatically be adjusted based on the width | |
convert -limit throttle 50 $file -resize 2500x -verbose $file |
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
function timeStringToFloat(time) { | |
var hoursMinutes = time.split(/[.:]/); | |
var hours = parseInt(hoursMinutes[0], 10); | |
var minutes = hoursMinutes[1] ? parseInt(hoursMinutes[1], 10) : 0; | |
var seconds = hoursMinutes[2] ? parseInt(hoursMinutes[2], 10) : 0; | |
return parseFloat((hours + (minutes / 60) + (seconds / 3600)).toFixed(2)); | |
} |