Skip to content

Instantly share code, notes, and snippets.

View glefait's full-sized avatar

Guillem Lefait glefait

View GitHub Profile
@glefait
glefait / get_resource_url.py
Created March 14, 2019 17:27
get xattr url of objects (downloaded resources)
for (o, url) in [(x, os.getxattr(x, 'user.xdg.origin.url')) for x in os.listdir('.') if 'user.xdg.origin.url' in os.listxattr(x)]: print(o, url)
@glefait
glefait / entite-publiques.csv
Created August 31, 2018 14:47
Entités publiques référencées sur adullact (2018-08-31)
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
Entités publiques
PASSAGE (LE) (38490 - LE PASSAGE)
A.C.T.I.S GRENOBLE (38000 - GRENOBLE)
A.GE.D.I (77440 - DHUISSY)
ABAUCOURT HAUTECOURT (55400 - ABAUCOURT HAUTECOURT)
ABRESCHVILLER (57560 - ABRESCHVILLER)
ABRETS (LES) (38490 - LES ABRETS)
ADINFER (62116 - ADINFER)
ADRETS (LES) (38190 - LES ADRETS)
ADULLACT (34000 - Montpellier)
import base64
print(base64.b64encode(''.join(['{:08b}'.format(ord(c))for c in input()[::-1]]).encode('ascii')).decode('ascii'))
#decode
#s=base64.b64decode(input());print(''.join([chr(int(s[i:i+8],2))for i in range(0,len(s),8)][::-1]))
@glefait
glefait / qrcode-rtl.py
Last active March 9, 2018 02:00
right to left unicode character to pown qrcode reader
# Use RTL unicode to trick QrCode reader
# Idea from Dylan Katz: https://twitter.com/Plazmaz
import qrcode
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
@glefait
glefait / alias.sh
Created January 31, 2018 12:38
delete and recreate virtualenv then install current python package
alias delgenvenv="current_env=`pwd | sed -nr 's#^.*?/([^/]+)$#\1#p'` \
&& echo \"destroy virtualenv $current_env\" \
&& (deactivate || echo 'skip deactivate') \
&& (rm -Rf ~/.virtualenvs/$current_env/ || echo 'skip rm') \
&& virtualenv ~/.virtualenvs/$current_env \
&& source ~/.virtualenvs/$current_env/bin/activate \
&& pip install -r requirements.txt"
@glefait
glefait / 0_reuse_code.js
Created May 22, 2014 07:18
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console