Skip to content

Instantly share code, notes, and snippets.

View gasp's full-sized avatar
🔧
hacking stuff

Gaspard Beernaert gasp

🔧
hacking stuff
View GitHub Profile

On my azerty keyboard, there is the § sign that I nearly never use. I like to use the × sign a lot

create a DefaultKeyBinding file

mkdir ~/Library/KeyBinding
vim DefaultKeyBinding.dict
" Show hidden characters and use Atom style.
set list
set listchars=tab:»\ ,eol:¬,space:.
if [ "$1" == "stash" -a "$2" == "poop" ]
then
command git stash pop
echo "
) )
( ) (
) _ )
( \_
_(_\ \)__
(____\___))"
@gasp
gasp / djb2.go
Created January 20, 2019 14:02 — forked from lmas/djb2.go
djb2, a non-cryptographic hash function
package djb2
// For when you ever need to implement a dictionary hash function,
// that's good enough, simple and fast.
//
// WARNING:
// Not cryptographicly secure!
//
// Source: https://en.wikipedia.org/wiki/DJB2
//
@gasp
gasp / france_departments.json
Last active January 19, 2019 10:16 — forked from pawndev/france_departments.json
Just a JSON that contains bounding box geocode for all france department
{
"franceDepartments": {
"01": {
"name": "Ain",
"bounds": {
"n": "46.519953",
"e": "6.170198",
"s": "45.611093",
"w": "4.728067"
}
@gasp
gasp / handler.test.js
Last active July 9, 2018 09:46
call async function on each array items
const test = require('ava')
// testing the logic
const event = {
Records: [
{
Sns: {
a: 1,
b: 2,
@gasp
gasp / multiple.sh
Created November 27, 2017 11:20
multiple bash processes
#!/usr/bin/env bash
sleep_date() {
echo "starting $1 at $(date)";
sleep $1;
echo "ending $1 at $(date)";
}
echo "starting all $(date)";
sleep_date 10 &
@gasp
gasp / stabilize.js
Created March 31, 2017 13:05
use ms video api to stabilize a video
// doc
// https://westus.dev.cognitive.microsoft.com/docs/services/565d6516778daf15800928d5/operations/565d6517778daf0978c45e35
const fs = require('fs');
const request = require('request'); // use npm i request
const create = (fileUrl) => {
return new Promise(function (resolve, reject) {
request({
method: 'post',
@gasp
gasp / Pilot.ino
Created March 26, 2016 15:27
My first arduino program using HC SRO4, Adafruit Motor Shield 2.3 and an old RC car
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_MS_PWMServoDriver.h"
// these constants won't change:
const int pinTrig = 13; // trigger sound with digital pin 13 (yellow)
const int pinEcho = 12; // green
const int pinLed = 10; // orange
const int threshold = 100; // threshold value to decide when the detected sound is a knock or not
Verifying that +gaspard is my blockchain ID. https://onename.com/gaspard