Skip to content

Instantly share code, notes, and snippets.

View pdonadeo's full-sized avatar

Paolo Donadeo pdonadeo

View GitHub Profile
@pdonadeo
pdonadeo / broken_client.ml
Created November 6, 2011 13:36
Source to reproduce a possible bug in BatEnum.lines_of
(* COMPILE WITH:
* ocamlfind ocamlc -g -linkpkg -package batteries broken_client.ml -o client *)
let in_, out_ = BatUnix.open_connection (Unix.ADDR_UNIX "my_socket");;
BatEnum.fold
(fun count l -> Printf.printf "%s\n%!" l; count + 1)
1
(BatIO.lines_of in_)
;;
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys, os, re, glob
import subprocess
from subprocess import *
def check_output(*popenargs, **kwargs):
# WORKS WITH PYTHON 2.6.x
if 'stdout' in kwargs:
@pdonadeo
pdonadeo / .bashrc
Last active December 27, 2015 13:59 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working directory clean" ]] && echo "*"
}
function parse_git_branch {
if [ "`git rev-parse --show-toplevel`" != "${HOME}" ]
/*
This program is an adaptation of the Mandelbrot program
from the Programming Rosetta Stone, see
http://rosettacode.org/wiki/Mandelbrot_set
Compile the program with:
gcc -o mandelbrot -O4 mandelbrot.c
Usage:
(* The Mandelbrot set.
Compile with:
ocamlbuild mandelbrot.native
Example usage:
./mandelbrot.native --xmin 0.27085 --xmax 0.27100 --ymin 0.004640 --ymax 0.004810 --xres 1000 --maxiter 1024 --file pic.ppm
@pdonadeo
pdonadeo / snap.sh
Created December 3, 2014 22:53
Directory snapshot
#!/bin/bash
BACKUP_TS=`date +"%FT%H.%M.%S"`
DIR=`basename "$@"`
TAR_FILE=${DIR}_${BACKUP_TS}.tar.bz2
SHA=${TAR_FILE}.sha1
tar --acls --selinux --xattrs --force-local \
@pdonadeo
pdonadeo / compile.sh
Last active August 29, 2015 14:12
ctypes bug description
#!/bin/bash
gcc -ansi -Wall foo_c.c -c -o foo_c.o
ocamlfind ocamlopt \
-verbose \
-linkpkg \
-package ctypes.foreign \
foo_c.o \
foo_ml.ml \

Keybase proof

I hereby claim:

  • I am pdonadeo on github.
  • I am pdonadeo (https://keybase.io/pdonadeo) on keybase.
  • I have a public key whose fingerprint is 038E 2B3F 01A2 2582 210E A61C 12FD A58D B634 8E24

To claim this, I am signing this object:

@pdonadeo
pdonadeo / IngressDualMap.user.js
Last active September 13, 2016 12:30 — forked from Terrance/IngressDualMap.user.js
An IITC plugin that exports portals currently in view as a CSV list for use with Ingress Dual Map.
// ==UserScript==
// @id iitc-plugin-ingressdualmap-exporter@OllieTerrance
// @name IITC plugin: Ingress Dual Map Exporter
// @category Keys
// @version 0.0.0.1
// @namespace https://github.com/jonatkins/ingress-intel-total-conversion
// @description Exports portals currently in view as a CSV list for use with Ingress Dual Map.
// @include https://www.ingress.com/intel*
// @include http://www.ingress.com/intel*
// @match https://www.ingress.com/intel*
@pdonadeo
pdonadeo / alessandria.json
Created September 13, 2016 15:12
Portali di Alessandria per fare unici
[{"type":"polyline","latLngs":[{"lat":44.899552,"lng":8.599138999999999},{"lat":44.90144,"lng":8.601578},{"lat":44.901576,"lng":8.601853},{"lat":44.902394,"lng":8.610906999999999},{"lat":44.90526,"lng":8.608293},{"lat":44.907351,"lng":8.610973},{"lat":44.907845,"lng":8.609597000000001},{"lat":44.908443,"lng":8.609131},{"lat":44.908798,"lng":8.606522999999999},{"lat":44.90912,"lng":8.607377},{"lat":44.910177,"lng":8.607150000000001},{"lat":44.910201,"lng":8.608034},{"lat":44.909414,"lng":8.608584},{"lat":44.908851,"lng":8.609044000000001},{"lat":44.908978,"lng":8.608354},{"lat":44.90915,"lng":8.608101},{"lat":44.909664,"lng":8.608988},{"lat":44.909756,"lng":8.609660999999999},{"lat":44.910187,"lng":8.610811999999999},{"lat":44.910273,"lng":8.611131},{"lat":44.908932,"lng":8.610033},{"lat":44.9092,"lng":8.610844},{"lat":44.908913,"lng":8.609339},{"lat":44.908935,"lng":8.609669999999999},{"lat":44.909143,"lng":8.611250999999999},{"lat":44.908507,"lng":8.611027},{"lat":44.910323,"lng":8.612546999999999},{"lat":44