Skip to content

Instantly share code, notes, and snippets.

@jul
jul / block.txt
Last active April 9, 2020 21:28
DNS personal domain blacklist include DNS over HTTP public server
# unbound domain blacklist that works with pihole? and my code
# https://gist.github.com/jul/40c35d751f513dab0e15f6ea9732ca83
# get_unbound_adblock.sh
optnx.com
xlanding.pw
jwpsrv.com
adnxs.com
faktor.io
ferank.eu
bidswitch.net
@jul
jul / get_unbound_adblock.sh
Last active January 9, 2023 06:24
update unbound adblocklist
#!/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)
@jul
jul / ldap2dhcp.py
Last active March 11, 2020 19:55
ldap 2 dhcpd
#!/usr/bin/env python3
from bla import *
from ldap3 import *
from contextlib import contextmanager
from sys import argv
import ipaddress as ip
netmask = lambda s: str(ip.IPv4Network("0.0.0.0/%s" % s.dhcpNetmask).netmask)
@jul
jul / gruic_calc.py
Last active September 22, 2019 18:46
une calculatrice qui parle (si espeak est installé)
#/!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Perversion
"""
from collections import MutableMapping, Counter, MutableSequence
from json import *
from functools import reduce
@jul
jul / dict_flatening_pandoc.py
Created September 18, 2019 10:31
Using recursion in a weired way to flatten a pandoc json (state serialisation of an AST I guess
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Perversion
"""
from collections import MutableMapping, Counter
from json import *
from functools import reduce
@jul
jul / try_it.py
Last active July 6, 2019 22:20
perf diff between reduce vs sum
from functools import reduce as r
from time import time as t
add = str.__add__
class S(str):
__neutral = ""
def __radd__(s, o):
o = o or S.__neutral
return add(s, o)
def __ladd__(o, s):
@jul
jul / sum vs reduce.py
Last active July 6, 2019 20:37
sum vs reduce v2
from functools import reduce
class string(str):
def __radd__(self, other):
other = other or ""
return reduce(str.__add__,("L" , other , "R+" , "R" , self))
def __add__(self, other):
other = other or ""
@jul
jul / sum vs reduce.py
Last active July 6, 2019 19:55
sum_vs_rediuce.py
from functools import reduce
class string(str):
def __ladd__(self, other):
other = other or ""
return reduce(str.__add__,("L" , self , "L+" , "R" , other))
def __radd__(self, other):
other = other or ""
return reduce(str.__add__,("L" , self , "R+" , "R" , other))
@jul
jul / matrix.py
Created October 29, 2018 13:41
Why Point2D is useless when dict supports LinearAlgebrae
#!/usr/bin/env python3
from archery import mdict, vdict
from math import pi, cos, sin, acos
class Matrix(mdict):
def __call__(self, other):
res= mdict()
for (src, dst), functor in self.items():
res += mdict({ dst: functor(other[src])})
return res
@jul
jul / reproduce_bug.py
Last active June 21, 2018 12:38
seek is sick ?
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
from sys import version
import platform
import locale
print("platfrom is %s" % platform.platform())
print("default locale is "+repr( locale.getdefaultlocale()))
print("locale is "+repr( locale.getlocale()))