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 | |
if [ $# -lt 3 ]; then | |
echo "usage: ./setup_ddb.sh db_name db_username db_password" | |
exit 1 | |
fi | |
DB_NAME="$1"; | |
DB_USERNAME="$2"; | |
DB_PASSWORD="$3"; |
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
#!/usr/bin/env bash | |
rsync -avz --exclude-from '.rsync-exclude-list.txt' \ | |
-e "ssh -i ~/.ssh/[ssh key]" \ | |
--progress * \ | |
-t [USER]@[IP]:~/[dest] |
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/sh | |
# Increase max user watches | |
# Option 1: Sysctl | |
sudo sysctl fs.inotify.max_user_watches=1048576 | |
sudo nano /etc/sysctl.d/99-sysctl.conf | |
sudo sysctl --system | |
# Option 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
#!/usr/bin/env bash | |
# Prepare the videos to be used over http with the MPEG-DASH protocol | |
# The vp9 codec is used for the videos because h265 is not supported by chrome and h264 is too big | |
# This script generates webm files | |
## DOCS | |
# https://developers.google.com/media/vp9/settings/vod/ | |
# https://developer.mozilla.org/en-US/docs/Web/HTML/DASH_Adaptive_Streaming_for_HTML_5_Video | |
# http://wiki.webmproject.org/adaptive-streaming/instructions-to-playback-adaptive-webm-using-dash |
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
#!/usr/bin/env bash | |
removevolumes() { | |
sudo docker volume rm $(sudo docker volume ls -qf dangling=true) | |
sudo docker volume ls -qf dangling=true | xargs -r sudo docker volume rm | |
} | |
removenetwork() { | |
sudo docker network ls | |
sudo docker network ls | grep "bridge" |
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
/** | |
* @argument callback function | |
* @argument arg argument | |
* @argument onMessageCallback function | |
* usage: runInWorker(function(e){return JSON.parse(e);}, '{"name": "toto"}', console.log); | |
**/ | |
function runInWorker(callback, arg, onMessageCallback){ | |
var blob = new Blob(['onmessage=function(_e){postMessage('+ callback.toString() + '(_e)); close();']); | |
var worker = new Worker(URL.createObjectURL(blob)); | |
worker.onmessage = onMessageCallback; |
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
#!/usr/bin/env bash | |
sudo docker run --rm -p 3306:3306 --name=mysql \ | |
-e MYSQL_ROOT_PASSWORD="1234" \ | |
-e MYSQL_DATABASE="test" \ | |
-e MYSQL_USER="test" \ | |
-e MYSQL_PASSWORD="1234" \ | |
-d mysql/mysql-server --default-authentication-plugin=mysql_native_password | |
sudo docker logs -f 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
# General | |
unameOut="$(uname -s)" | |
case "${unameOut}" in | |
Linux*) machine=Linux;; | |
Darwin*) machine=Mac;; | |
CYGWIN*) machine=Cygwin;; | |
MINGW*) machine=MinGw;; | |
*) machine="UNKNOWN:${unameOut}" | |
esac |
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
#!/usr/bin/env python | |
# Using a pivot | |
# Place value lower than pivot to the left, greater to the right | |
# Sort left and right recursively | |
def quick_sort(arr): | |
less, equal, greater = [], [], [] | |
if len(arr) > 1: | |
pivot = arr[0] |
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
#!/usr/bin/env bash | |
set -e | |
### Youtube | |
URLS=( | |
"https://www.youtube.com/watch?v=YbH1E2R9TOM" | |
"https://www.youtube.com/watch?v=fdNYW23Vm_c" | |
"https://www.youtube.com/watch?v=gh0faLFKl3w" | |
"https://www.youtube.com/watch?v=Homukj0sBYU" |
OlderNewer