This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -e | |
declare -a action; | |
DEBUG=1 | |
RD='\e[31m' | |
GB='\e[33m' | |
BL='\e[34m' | |
GR='\e[0;90m\e[1;47m' | |
RZ='\e[0m' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import psycopg2 | |
from datetime import date, datetime, timedelta | |
from archery import mdict | |
def int_env_default(var, default): | |
return int(os.getenv(var) or default) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# WTFPL 2.0 do whatever the freak you want with this code except claiming its yours. | |
#!/usr/bin/env python3 | |
from random import shuffle | |
import PySimpleGUI as sg | |
N=5 | |
M=4 | |
first = True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# requires pip install multipart | |
import multipart | |
from wsgiref.simple_server import make_server | |
from json import dumps | |
from urllib.parse import parse_qsl | |
# require pip install confined my OWN FORTH BASED templating SYNTAX | |
from confined import templatize | |
class e: a=0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multipart | |
from wsgiref.simple_server import make_server | |
from json import dumps | |
from urllib.parse import parse_qsl | |
import logging | |
def simple_app(environ, start_response): | |
fo,fi=multipart.parse_form_data(environ) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# author julien@tayon.net | |
# licence WTFPL2.0 | |
WORKDIR=./__ | |
WVENVDIR=todel | |
GRUIK= | |
PYTHON= | |
export WVENVDIR | |
UPGRADE_PIP=hygien | |
TO_KEEP_OR_NOT_TO_KEEP="DONT_KEEP" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
from requests import get | |
import re | |
''' | |
sometimes, you want a minimalistic magic number detection for simple file types. | |
Like for instance, you scrap the web and you don't trust the web server when returning the mime type | |
(actually happened to me on bilbliothèque nationale de france more than once) | |
So, yo want to make sure that for instance, the returned content is atcually a jpeg, and you may not be | |
on a unix OS with libmagic and you may not want to add dependencies and ... | |
just comparing 3 bytes in a row in a raw byte stream is not THAT hard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export LANG=C | |
redadd() { python3 -c '(s,d,r)=(__import__("sys"),__import__("archery").mdict,__import__("functools").reduce);print(sorted(r(d.__add__,(d({l[:-1]:1}) for l in s.stdin.readlines())).items(),key=lambda k:k[1],reverse=True)[:10])' ; } | |
red() { python3 -c '(s,d,r)=(__import__("sys"),__import__("archery").mdict,__import__("functools").reduce);print(sorted(r(d.__radd__,(d({l[:-1]:1}) for l in s.stdin.readlines())).items(),key=lambda k:k[1],reverse=True)[:10])' ; } | |
function count() { python3 -c'(s,d)=(__import__("sys"),__import__("archery").mdict);print(sorted(sum((d({l[:-1]:1}) for l in s.stdin.readlines()),{}).items(),key=lambda k:k[1],reverse=True)[:10])'; } | |
cfl() { python3 -c'(s,t,d,f)=(__import__("sys"),__import__("tld"),__import__("archery").mdict,lambda l:t.get_fld(l[:-1],fix_protocol=True,fail_silently=True));print(sorted(sum((d({f(l):1}) for l in s.stdin.readlines()),{}).items(),key=lambda k:k[1],reverse=True)[:10])'; } | |
test_time() { | |
func="$1" | |
TIMEFORMAT="%U" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# specs for virtual machine | |
declare -A VMACHINE=( [RAM]=4g [CPU]=2 ) | |
# you can override them by redifining them in this file | |
[ -e specs.sh ] && source ./specs.sh | |
function require () { which $1 &> /dev/null && echo "$1 OK" || ( echo "ARG: You SHOULD install $1 $@"; exit 1; ) } | |
echo CHECKING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import PySimpleGUI as sg | |
from operator import itemgetter | |
### uitliser ipython -i argv[0] pour être en interactif et faire joujou | |
can = sg.Canvas(size=(1412,998)) | |
status=sg.Text('status') | |
win = sg.Window("titre",[[can,],[status,],], finalize=True) | |
c = can.TKCanvas | |
from time import sleep, time | |
from random import randint | |
from os import system |
NewerOlder