Skip to content

Instantly share code, notes, and snippets.

View adrienjoly's full-sized avatar
☺️
In the flow

Adrien Joly adrienjoly

☺️
In the flow
View GitHub Profile
@adrienjoly
adrienjoly / Cod.java
Created June 12, 2011 19:44
My solution to @code_of_duty challenge
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintStream;
/**
* Proposed solution to Code of Duty
* @author adrienjoly
* This program is dedicated to Anouck ^^
**/
@adrienjoly
adrienjoly / .git-config
Created June 25, 2011 18:25 — forked from mikeymckay/config
git config for auto push to gh-pages
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
ignorecase = true
[remote "origin"]
url = git@github.com:adrienjoly/playem.git
fetch = +refs/heads/*:refs/remotes/origin/*
push = +refs/heads/*:refs/heads/*
@adrienjoly
adrienjoly / thecallr.js
Created September 23, 2011 05:52
A simple JSON-RPC call to send a SMS from Node.JS, through Thecallr
/**
* Send a SMS using "Thecallr" service
* @author adrienjoly, "Hear I Am" (#4sqHackathon)
*/
var https = require('https');
var authStr = new Buffer(login + ":" + password).toString('base64'); // <-- your creds here
exports.sendSMS = function (phone, msg, callback) {
var query = {
@adrienjoly
adrienjoly / consoleLogProxy.js
Created October 19, 2011 18:48
console.log proxy function
console.log = function() {
for (var i in arguments)
if (arguments[i] instanceof Object || arguments[i] instanceof Array)
arguments[i] = sys.inspect(arguments[i]);
log(Array.prototype.join.call(arguments, " ") + '\n');
};
@adrienjoly
adrienjoly / fb_helpers.py
Created November 17, 2011 18:05 — forked from droot/fb_helpers.py
facebook signed_request parsing in python
import base64
import hashlib
import hmac
import simplejson as json
def base64_url_decode(inp):
padding_factor = (4 - len(inp) % 4) % 4
inp += "="*padding_factor
return base64.b64decode(unicode(inp).translate(dict(zip(map(ord, u'-_'), u'+/'))))
@adrienjoly
adrienjoly / buildRollback.sh
Created November 30, 2011 19:59
create a script that checks out the current GIT revision (e.g. before pulling / switching to another)
#!/bin/bash
echo "git checkout `git rev-parse HEAD` ." >rollback.sh
chmod +x rollback.sh
echo "rollback script saved in rollback.sh:"
cat rollback.sh
@adrienjoly
adrienjoly / include.js
Created February 14, 2012 13:20
native code to include a javascript / css file dynamically in a html document
function include(src, callback) {
var ext = src.split(/[\#\?]/)[0].split(".").pop().toLowerCase();
var inc;
if (ext == "js") {
inc = document.createElement("script");
inc.src = src;
inc.onload = inc.onreadystatechange = callback;
}
else {
inc = document.createElement("link");
@adrienjoly
adrienjoly / findDuplicates.sh
Created March 1, 2012 09:37
mac os script to detect duplicate files recursively, and store the list in a text file. taken from: http://hints.macworld.com/article.php?story=20010828211333805
find . -size +20 \! -type d -exec md5 -r {} \; | sort | tee /tmp/f.tmp | cut -f 1 -d ' ' | uniq -d | grep -hif - /tmp/f.tmp > dup.txt
@adrienjoly
adrienjoly / osx_script_header.sh
Created September 27, 2012 14:27
osx/bash script commands to set the terminal window's title and current path
# set mac osx's terminal title to "My Title"
echo -n -e "\033]0;My Title\007"
# make sure to switch to the script's dir (e.g. when launched via mac osx's finder)
cd `dirname "$0"`
@adrienjoly
adrienjoly / backup.sh
Created October 1, 2012 09:48
retrieve the backup/dump of a remote database locally
echo
echo Dumping remote database...
ssh -i ~/.ssh/mykey -p 8080 my@domain.com 'cd ./db;./dumpDB.sh'
echo
echo Downloading dump to ./dump...
scp -i ~/.ssh/mykey -P 8080 -p -r my@domain.com:/home/me/db/dump ./
echo
echo Done!