Skip to content

Instantly share code, notes, and snippets.

View kstefanini's full-sized avatar
🛌
overbooké

Killian Stefanini kstefanini

🛌
overbooké
View GitHub Profile
(function($,sr){
// debouncing function from John Hann
// http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/
var debounce = function (func, threshold, execAsap) {
var timeout;
return function debounced () {
var obj = this, args = arguments;
function delayed () {
# ----------------------
# installing dnsmasq and enable daemon
# ----------------------
brew install dnsmasq
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons
# ----------------------
# adding resolver for local domain
# ----------------------
[ -d /etc/resolver ] || sudo mkdir -v /etc/resolver
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/local'
@kstefanini
kstefanini / non-free.sh
Created September 24, 2014 10:02
Debian non-free script - Writes sources.list in order to add non-free repository
#!/bin/bash
#
# Writes sources.list in order to add non-free repository
#
DEBIAN_RELEASE=`cat /etc/*-release 2> /dev/null | grep PRETTY_NAME | awk -F "=" {'print $2'} | awk -F "(" {'print $2'} | awk -F ")" {'print $1'}`
echo "Writes /etc/apt/sources.list in order to add $DEBIAN_RELEASE non-free repository"
@kstefanini
kstefanini / pullauto.sh
Last active February 22, 2017 14:11
Cron-able script for auto pull
#!/bin/bash
# Permet de mettre à jour un dépot git local à partir d'un remote github
# Va chercher le sha du dernier commit distant et le compare au sha stocké
# suite au dernier lancement du script. Si le sha est différent, le
# script lance le git pull
# Si le script est bloqué, faut vider le fichier dans /tmp avant de relancer
OWNER="telabotanica"
#!/bin/bash
##
## Pour mettre à jour le thème wordpress (https://github.com/telabotanica/wp-theme-telabotanica/)
##
## Killian, 9 mars 2017
dossier_env_test="/home/beta/www/test/wp-content/themes/telabotanica"
dossier_env_preprod="/home/beta/www/preprod/wp-content/themes/telabotanica"
fetch="git fetch origin"
@kstefanini
kstefanini / resize-image.sh
Created February 20, 2018 15:24
Crawl folders and resize images
width=1600
height=1200
for FILE in $(
find . -type f -exec file {} \; |
awk -F: '{if ($2 ~/image/) print $1}'
);
do
identify -format '%w %h %i\n' "$FILE" |
awk '$1 > $width || $2 > $height {sub(/^[^ ]* [^ ]* /, ""); print}' |