Skip to content

Instantly share code, notes, and snippets.

View gduverger's full-sized avatar

Georges Duverger gduverger

View GitHub Profile
@gduverger
gduverger / sh
Created December 19, 2018 13:00
# http://amoffat.github.io/sh/
import sh
sh.diff('file-1.txt', 'file-2.txt', unified=3, _out='diff.patch', _ok_code=1)
import os
import base64
import requests
URL = 'https://logs.timber.io/frames'
TOKEN = base64.urlsafe_b64encode(os.environ.get('TIMBER_API_KEY').encode('utf-8')).decode('utf-8')
HEADERS = {
'Content-Type': 'text/plain',
'Cache-Control': 'no-cache',
'Authorization': 'Basic {}'.format(TOKEN)
@gduverger
gduverger / reply.py
Last active November 12, 2015 18:23
How Fitmeal replies to text messages with nutrition facts (edited snippet)
def reply(request):
"""
Reply to a text message with nutrition facts (edited snippet)
"""
args = {}
if request.method == 'POST':
# Get the text message
text = request.POST.get('text')
@gduverger
gduverger / members.csv
Last active August 29, 2015 14:19
Le vote des 575 députés français au cours des 1108 scrutins de la 14e législature (1 : pour, 2 : contre)
We can't make this file beautiful and searchable because it's too large.
member_name,member_group,1108,1107,1106,1105,1104,1103,1102,1101,1100,1099,1098,1097,1096,1095,1094,1093,1092,1091,1090,1089,1088,1087,1086,1085,1084,1083,1082,1081,1080,1079,1078,1077,1076,1075,1074,1073,1072,1071,1070,1069,1068,1067,1066,1065,1064,1063,1062,1061,1060,1059,1058,1057,1056,1055,1054,1053,1052,1051,1050,1049,1048,1047,1046,1045,1044,1043,1042,1041,1040,1039,1038,1037,1036,1035,1034,1033,1032,1031,1030,1029,1028,1027,1026,1025,1024,1023,1022,1021,1020,1019,1018,1017,1016,1015,1014,1013,1012,1011,1010,1009,1008,1007,1006,1005,1004,1003,1002,1001,1000,999,998,997,996,995,994,993,992,991,990,989,988,987,986,985,984,983,982,981,980,979,978,977,976,975,974,973,972,971,970,969,968,967,966,965,964,963,962,961,960,959,958,957,956,955,954,953,952,951,950,949,948,947,946,945,944,943,942,941,940,939,938,937,936,935,934,933,932,931,930,929,928,927,926,925,924,923,922,921,920,919,918,917,916,915,914,913,912,911,910,909,908,907,906,905,904,903,902,901,900,899,898,897,896,895,894,893,892,891,890,889,888,887,88
@gduverger
gduverger / gist:a8a16813d57ddd8ae726
Last active August 29, 2015 14:16
Most Informative Features
contains(burger) = True GAIN : LOSS = 5.5 : 1.0
contains(cucumber) = True LOSS : GAIN = 5.1 : 1.0
contains(peppers) = True LOSS : GAIN = 5.1 : 1.0
contains(Heineken) = True GAIN : LOSS = 4.8 : 1.0
contains(wasabi) = True LOSS : GAIN = 3.9 : 1.0
contains(Popsicles) = True LOSS : GAIN = 3.9 : 1.0
contains(Blonde) = True LOSS : GAIN = 3.9 : 1.0
contains(no) = True LOSS : GAIN = 3.8 : 1.0
contains(Merlot) = True LOSS : GAIN = 3.3 : 1.0
contains(fish) = True LOSS : GAIN = 3.3 : 1.0
@gduverger
gduverger / gist:c332fa4f5e0f748fbdc5
Last active August 29, 2015 14:15
Staging environment on Heroku
$ heroku fork -a app app-staging
$ heroku info -a app-staging
Git URL: https://git.heroku.com/app-staging.git
$ git remote add staging [email protected]:app-staging.git
$ git remote -v
$ git push staging
@gduverger
gduverger / gist:2b72aa0bdb39ddce5b06
Last active August 29, 2015 14:13
JavaScript module
/*global window, jQuery */
( function( $, window, undefined ) {
/**
* --------------------------------- VARS ---------------------------------
*/
var module,
DEFAULTS = {
@gduverger
gduverger / correlations.txt
Last active August 29, 2015 14:10
1st attempt at quantifying my weight fluctuations per food item
1. "pea" +1.716lb
2. "onion" +1.681lb
3. "grape" +0.685lb
4. "tomato" +0.372lb
5. "champagne" +0.104lb
6. "arugula" +0.093lb
7. "chicken" +0.092lb
8. "ricotta" +0.089lb
9. "cannoli" +0.086lb
10. "pancetta" +0.074lb
\list # lists all databases
create database database_name; # create a database
DROP DATABASE database_name; # drop database
\c db_name # connect to a certain database
\dt # lists all tables in the current database
\d table_name # view table
DROP TABLE table_name; # drop table
\q # exit
@gduverger
gduverger / gist:e2f6d8ac969bf79ba0cc
Created October 27, 2014 22:00
Python command line script
#!/usr/bin/python
import sys
def main(argv):
print("main")
if __name__ == "__main__":
main(sys.argv[1:])