Skip to content

Instantly share code, notes, and snippets.

@guillaumewuip
guillaumewuip / post-receive
Last active November 1, 2023 16:54
Git post-receive hook : build then run a docker container
#!/usr/bin/env bash
# A git post-receive hook
#
# On master branch only :
# 1. It builds a docker image named with the dir name
# 2. It then stop container of the same name, rm it and start a new one
## --- Config
@guillaumewuip
guillaumewuip / camera.js
Last active October 29, 2018 15:24
Mock an UPnP Sony Camera
/**
* Mock the Sony QX1 SSDP discovery proces
*/
var dgram = require('dgram'),
parse = require('./parse'), //helper
client = dgram.createSocket('udp4');
var UPNP_PORT = 1900;
HTTP_PORT = 8080;
{
/*
* ENVIRONMENTS
* =================
*/
// Define globals exposed by modern browsers.
"browser": true,
// Define globals exposed by jQuery.
//Want to use 2 terminal window to see the same tmux session
//eg. showing one tmux window on one screen, an other on an other screen
//on the second terminal
//attach an existing tmux session
tmux new-session -t <the_session_you_want_to_connect_to>
//resize only the current window to the smallest client (not all the session)
//this way you can work on two different tmux window without having the whole tmux sessions resised
@guillaumewuip
guillaumewuip / update.md
Last active March 14, 2016 20:36
Update rooted Nexus 5 from UNIX

How to update rooted Nexus5 with last factory image without loosing app or files

  • download last factory image from Google Dev platform and unzip
  • download last TWRP recovery for Nexus 5
  • download last SuperSu version for Nexus 5
  • adb devices Device should be listed here
  • adb reboot bootloader Reboot on bootloader
@guillaumewuip
guillaumewuip / movToGif.sh
Created April 23, 2016 10:16
.mov to .gif
ffmpeg -i in.mov -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > out.gif
#from http://apple.stackexchange.com/a/211219/149089
@guillaumewuip
guillaumewuip / script.sh
Created May 30, 2016 05:33
Rename pictures in directory with 001.JPG, 002.JPG ... if they were named 1.JPG 2.JPG, ...
FILES=./*.JPG
for f in $FILES
do
filename=`basename $f`;
filename="${f%.*}"
filename="${filename#./}"
newFilename=`printf "%03s\n" $filename`;
echo $newFilename.jpeg;
@guillaumewuip
guillaumewuip / gitlab_ci.yml
Created June 26, 2016 16:49
Gitlab CI to dokku
###############################################################################
# Variables #
###############################################################################
variables:
DOKKU_HOST: 'host.com'
PROJECT_NAME: 'project_name'
###############################################################################
# Cache #
###############################################################################
@guillaumewuip
guillaumewuip / org.dokku.start.plist
Last active July 2, 2016 19:25
macOS launch daemon for dokku
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.dokku.start</string>
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin</string>
@guillaumewuip
guillaumewuip / script.js
Last active September 16, 2016 06:20
Google Sheet Script to distribute projects to groups
var CHOICES_SHEETS = 'Choix',
PROJECTS_SHEETS = 'Sujets',
RESULTS_SHEETS = 'Résultat';
/**
* randomInt
* @return {Number} An int in [0; max[
*/
var randomInt = function (max) {
var max = Math.floor(max);