Skip to content

Instantly share code, notes, and snippets.

View chibani's full-sized avatar

Loïc Gerbaud chibani

View GitHub Profile
@chibani
chibani / logseq.txt
Created December 5, 2022 10:04
Logseq Quickcapture (with selection)
javascript:var d = document,w = window,f = `logseq://x-callback-url/quickCapture?url=${e(l.href)}&title=${e(d.title)}&content=${e(w.getSelection?w.getSelection().toString():d.getSelection?d.getSelection():d.selection.createRange().text)}&x-source=bm`,l = d.location,e = encodeURIComponent,a = () => l.href = f;if (/Firefox/.test(navigator.userAgent)) setTimeout(a, 0);else {a()}void(0)
@chibani
chibani / get.sh
Created February 2, 2019 13:32
Téléchargement de magazine TPMA
#!/bin/sh
if [ $# -lt 3 ]; then
echo 1>&2 "$0: Manque d'arguments (./get.sh magazine numéro nombre de pages). Ex: ./get.sh JDPE 115 68"
exit 2
fi
#NUMERO du mag, numéro de dernière page
MAG=$1
@chibani
chibani / trafficlights.ino
Last active May 28, 2016 15:08
Mini trafic lights (mainly for kids) with an Arduino
// Traffic lights
// See : (french) http://blog.loicg.net/bricolage/2016/05/27/feux-tricolores-arduino.html
const int roadA[3] = {7,8,9};// Pins mapping for A group (Green, Orange, Red)
const int roadB[3] = {10,11,12}; // Pins mapping for B group (Green, Orange, Red)
const int sequenceA[6] = {0,1,2,2,2,2};// Lights sequence for A (Green, Orange, Red, Red, Red, Red)
const int sequenceB[6] = {2,2,2,0,1,2};// Lights sequence for B (Red, Red, Red, Green, Orange, Red)
const int timing[3] = {10,2,1};// In seconds (time for Green, Orange, Red)
const int timeSequence[6] = {timing[0], timing[1],timing[2],timing[0], timing[1],timing[2]};// Green (A), Orange (A), Red (both), Green (B), Orange (B), Red (both)
@chibani
chibani / .gitconfig
Created December 1, 2015 15:00
Git alias for creating new work branch with empty commit
[alias]
start = "!sh -c 'git checkout -b \"${0-workbranch}\" && git commit --allow-empty -m \"${1-start}\"'"
Usage :
git start
git start branch-name
git start branch-name "commit message"
@chibani
chibani / gist:05f2b20d216d540a2779
Created October 8, 2015 20:33
Batch resize images, filling them (if needed) with white background
mogrify -resize 180x66 -gravity center -extent 180x60 -format jpg -path resized/ ./*.*

Keybase proof

I hereby claim:

  • I am chibani on github.
  • I am chibani (https://keybase.io/chibani) on keybase.
  • I have a public key whose fingerprint is 0FA5 1579 2BF6 456E 57E4 385C FD26 F7FA AEE0 C351

To claim this, I am signing this object:

@chibani
chibani / .htaccess
Created November 16, 2014 13:21
.htaccess specific version
# Use case (mine) :
# You're deploying a new version of a website on client's hosting.
# Of course, the previous website is in the root directory...
# You want your v2/ directory to be visible only for you and the client
# And the client (and perhaps you) doesn't have a static IP...
#
# In this case, I've decided to use a cookie.
# But, how may I set a cookie in the clients browser ?
# What if she wants to browser thi shinny new website with her smartphone or tablet ???
# What if she wants to show it to her team or even family ???
@chibani
chibani / gist:f24ad9feded5134a3600
Created October 23, 2014 09:04
Count different lines between 2 text (csv) files
diff -U 0 file1.csv file2.csv | grep '^-[^-]' | wc -l
@chibani
chibani / 107-devcom
Created March 18, 2013 15:06
Exemple d'utilisation du mod_alias et des VirtualDocumentRoot pour configurer facilement une machine de dev
<VirtualHost *:80>
ServerName www.loicg.dev.com
ServerAlias *.*.dev.com
VirtualDocumentRoot /home/web/workspace/%2/%1
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride All
</Directory>
</VirtualHost>