Skip to content

Instantly share code, notes, and snippets.

Avatar

Guillem Lefait glefait

View GitHub Profile
@glefait
glefait / solaar_autostart.sh
Created May 12, 2020
raspian + solaar : stop annoying window
View solaar_autostart.sh
$ cat /etc/xdg/autostart/solaar.desktop
[Desktop Entry]
Name=Solaar
Comment=Logitech Unifying Receiver peripherals manager
Exec='solaar --window=hide'
Icon=solaar
StartupNotify=false
Terminal=false
Type=Application
Keywords=logitech;unifying;receiver;mouse;keyboard;
View gist:f6b6737acb8c0b63fe9337db53dfa589
#!/bin/bash
for i in {1..1000}; do
line="$(date +'%F %T') $(ping -c 25 193.252.148.140|tail -n 2|tr '\n' '\t')";
echo $line >> ~/sfr_ping.txt;
echo $line;
done
@glefait
glefait / ladocumentationfrancaise.fr.json
Created Oct 22, 2019
Scan 2019-10-22 https://www.ladocumentationfrancaise.fr : stealth pupeeter - single page & no action
View ladocumentationfrancaise.fr.json
{
"cookie": {
"route": "cfd2bfd3459b299d8a4ed95df56eda81",
"xtvrn": "$486404$",
"__trossion": "1571692868_1800_1__aafa479d-4d93-445a-a529-5831f28b43ad%3A1571692868_1571692868_1",
"__troRUID": "aafa479d-4d93-445a-a529-5831f28b43ad",
"__troSYNC": "1"
},
"localStorage": {},
"scripts": [
@glefait
glefait / decode.js
Last active Apr 12, 2019
decode Google Code Competition data
View decode.js
var googleCodeDecode = function (e) {
return JSON.parse(atob(e.replace(/[-_]/g, function(e) { return "-" == e ? "+" : "/" }).replace(/[^A-Za-z0-9\+\/]/g, "")));
}
var googleCodeEncode = function (e) {
return btoa(JSON.stringify(e)).replace(/[+/]/g, function(e) { return "+" == e ? "-" : "_" }).replace(/[^A-Za-z0-9\+\/]/g, "")));
}
params = {"min_rank": 1, "num_consecutive_users": 100};
// url example to get the first 100 results:
@glefait
glefait / get_resource_url.py
Created Mar 14, 2019
get xattr url of objects (downloaded resources)
View get_resource_url.py
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 Aug 31, 2018
Entités publiques référencées sur adullact (2018-08-31)
View entite-publiques.csv
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)
View coucourealhmx.py
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 Mar 9, 2018
right to left unicode character to pown qrcode reader
View qrcode-rtl.py
# 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 Jan 31, 2018
delete and recreate virtualenv then install current python package
View alias.sh
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
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
You can’t perform that action at this time.