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
#!/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
"""A heap is a recipie to represent an array as a | |
binary tree. | |
A binary tree is a convenient structure for | |
manipulating ordered data. | |
Said simply: | |
we implement a binary tree abstraction on top of an array. | |
this tree as the following properties: | |
any child value is smaller than its parent's value | |
left child is greater than right child. |
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 | |
# | |
# FUCKING PUBLIC LICENCE | |
# This code belongs to me jul@github.com/@obnoxiousJul and all (insert <#alias>) contributing in making it fun. | |
# And fucking stop being Pissenlit Würzel Schleckers met bigoudis with open source devs and maintainers | |
# v 0.5.1 cross devuan/debian restarting of unbound | |
# v 0.5 having fun | |
# v 0.4 code got ugly, BUT, making dynamic list from adblock conf for firefox (easylist) |
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 python | |
# version 2 here https://gist.github.com/jul/200d3a5895a437e20df6 | |
from cmath import polar, rect, pi as PI, e as E, phase | |
rad_to_deg = lambda r : r/2/PI*360.0 | |
deg_to_rad = lambda r : r*2*PI/360.0 | |
identity = lambda r: r | |
class Point(complex): |
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
from PIL import Image, ImageDraw | |
from cmath import pi as PI, e as E | |
I = complex("j") | |
to_x_y = lambda cpl : (cpl.real, cpl.imag) | |
im = Image.new("RGB", (890, 890), "white") | |
draw = ImageDraw.Draw(im) | |
rotation = E**(I*PI/3) | |
homothetia = min( im.size[0], im.size[1]) | |
# to bored to be smart, random guessing |
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 |
NewerOlder