Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Massimo Santini mapio

🎯
Focusing
Block or report user

Report or block mapio

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@mapio
mapio / Vagrantfile
Last active Aug 29, 2015
La configurazione di Vagrant per la macchina virtuale codebox4im
View Vagrantfile
Vagrant.configure("2") do |config|
if ARGV[0] == 'up' || ARGV[0] == 'provision' || ARGV[0] == 'reload'
if File.exists?( 'provision.sh' )
$provisioning_script = File.open( 'provision.sh' ).read
$stderr.puts( "Using 'provision.sh' for provisioning...\n" )
else
require 'net/http'
$provisioning_script = Net::HTTP.get(URI('https://gist.githubusercontent.com/mapio/ef23edceb8a5709b87d0/raw/provision.sh'))
$stderr.puts( "Downloaded gist #ef23edceb8a5709b87d0 for provisioning...\n" )
@mapio
mapio / HOWTO-GUNICORN-GEVENT-OSX-YOSEMITE.md
Last active Aug 29, 2015
How to install gunicorn + gevent on OS X 10.10 Yosemite
View HOWTO-GUNICORN-GEVENT-OSX-YOSEMITE.md

Given that I've spent a few hours to get it right, here is how I did it.

First install the required dependencies using Homebrew, by this I mean at least

brew install python libevent

Then upgrade setuptools with

curl https://bootstrap.pypa.io/ez_setup.py -o - | python
@mapio
mapio / opearazioni.py
Last active Aug 29, 2015
Come tenere occupato un nano saccente…
View opearazioni.py
# -*- coding: utf-8 -*-
import subprocess
from random import randint, choice
VOCI = "Alice", "Federica", "Luca", "Paola"
COMPIMENTI = "geniaccio", "sei un figo", "super", "che gallo"
OFFESE = "coglionazzo", "minchione", "cacchio dici"
OP = ( lambda a, b: a + b, "più"), ( lambda a, b: a - b, "meno" )
@mapio
mapio / collapse
Created Jan 15, 2015
A trick to collapse Mercurial revisions in steps
View collapse
#!/bin/bash
dbg() {
echo WORK
hg -R work log --template '{node|short} {desc}\n'
echo PUBLIC
hg -R public log --template '{node|short} {desc}\n'
echo CLEAN
hg -R clean log --template '{node|short} {desc}\n'
}
@mapio
mapio / hg_archive.sh
Last active Aug 29, 2015
How to "archive" an initial segment of a Mercurial repository history.
View hg_archive.sh
# let's assume that we have an "original" repo and that we want to
# create a new "archvied" repo with a first release corresponding to what
# happened in the original repo in revisions O:ARCHIVE, plus all the
# releases (ARCHIVE+1):tip in the original repo.
# first remove the cruft from the previous run
rm -rf original archived
# now create the "original" repository that will contain a
@mapio
mapio / digitalocean.txt
Created Jan 18, 2015
Linode vs. Digitalocean
View digitalocean.txt
========================================================================
BYTE UNIX Benchmarks (Version 5.1.3)
System: digitalocean: GNU/Linux
OS: GNU/Linux -- 3.8.0-38-generic -- #56~precise1-Ubuntu SMP Thu Mar 13 16:22:48 UTC 2014
Machine: x86_64 (x86_64)
Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
CPU 0: QEMU Virtual CPU version 1.0 (4800.0 bogomips)
x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET
19:06:58 up 4 days, 15:52, 1 user, load average: 0.62, 0.58, 0.31; runlevel 2
@mapio
mapio / IGDesktopOSXClient.md
Last active Aug 29, 2015
How to install a kind of desktop client for Instagram on OSX
View IGDesktopOSXClient.md

You just need two steps:

Invoking `instagram' from the shell will then do the trick.

@mapio
mapio / bookmarklet.js
Last active Aug 29, 2015
A bookmarklet to go from Java 7 APIs documentation to Java 8 APIs documentation
View bookmarklet.js
javascript:window.location.assign(window.location.href.replace( /javase\/7\//, 'javase/8/' ));
@mapio
mapio / serve.sh
Created Apr 17, 2015
A small script to serve a local directory via HTTP
View serve.sh
#!/bin/bash
# see http://veithen.github.io/2014/11/16/sigterm-propagation.html
trap 'kill -TERM $PID' TERM INT
python -m SimpleHTTPServer & PID=$!
python -m webbrowser -t "http://127.0.0.1:8000/"
wait $PID
@mapio
mapio / app.py
Created May 11, 2015
A flask-admin bug report concerning FileUploadField
View app.py
from functools import partial
from os import remove
from os.path import join
from flask import Flask
from flask.ext.admin import Admin, form
from flask.ext.admin.contrib.sqla import ModelView
from flask.ext.sqlalchemy import SQLAlchemy
from sqlalchemy.event import listens_for
You can’t perform that action at this time.