Skip to content

Instantly share code, notes, and snippets.

View guillaumevincent's full-sized avatar

Guillaume Vincent guillaumevincent

View GitHub Profile
@guillaumevincent
guillaumevincent / Raspberry pi modt
Created March 10, 2014 10:16
Version française du modt trouvé ici http://www.raspberrypi.org/phpBB3/viewtopic.php?t=23440 pour raspberry pi
#!/usr/bin/env tclsh
set var(user) $env(USER)
# * Calculate current system uptime
set uptime [exec -- /usr/bin/cut -d. -f1 /proc/uptime]
set up(days) [expr {$uptime/60/60/24}]
set up(hours) [expr {$uptime/60/60%24}]
set up(mins) [expr {$uptime/60%60}]
set up(secs) [expr {$uptime%60}]
@guillaumevincent
guillaumevincent / fingerprint
Last active August 29, 2015 14:01
my PGP public key
C54A 0330 D1E5 6239 52E5 6638 E3E2 BD4F 3630 BCCF
# Easier way to install FreeBSD 10 on a Dedibox using the rescue system
# - no vnc
# - no qemu network unable to join the host network issue
sudo su -
apt-get update && apt-get install qemu
wget ftp://ftp.freebsd.org/pub/FreeBSD/releases/amd64/amd64/ISO-IMAGES/10.1/FreeBSD-10.1-RELEASE-amd64-disc1.iso
qemu-system-x86_64 -no-kvm -hda /dev/sda -cdrom FreeBSD-10.1-RELEASE-amd64-disc1.iso -curses -boot d
# Then
@guillaumevincent
guillaumevincent / test_xmldiff.py
Last active August 29, 2015 14:21
xml diff in python with xmltodict
import unittest
from xmldiff import XmlDiff
class XMLDiffTestCase(unittest.TestCase):
def test_xml_equal(self):
xml1 = """<a></a>"""
xml2 = """<a></a>"""
self.assertTrue(XmlDiff(xml1, xml2).equal())
@guillaumevincent
guillaumevincent / console.log
Created July 5, 2015 18:44
Copy img to usb on Mac OS X
~ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *121.3 GB disk0
1: EFI EFI 209.7 MB disk0s1
2: Apple_CoreStorage 120.5 GB disk0s2
3: Apple_Boot Recovery HD 650.1 MB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Apple_HFS Macintosh HD *120.1 GB disk1
@guillaumevincent
guillaumevincent / Gulpfile.js
Created December 2, 2015 11:53 — forked from thom4parisot/Gulpfile.js
gulp -> npm scripts only
'use strict';
var pkg = require('./package.json');
var gulp = require('gulp');
var utils = require('gulp-util');
var source = require('vinyl-source-stream');
var isWatching = false;
var isProduction = process.env.NODE_ENV === 'production';
@guillaumevincent
guillaumevincent / gist:4745647
Last active December 12, 2015 08:39
Basic authentication with Tornado. Tornado doesn't provide a good documentation when you try to handle your own login service. I tried to do mine My new gist : https://gist.github.com/guillaumevincent/4771570
import tornado.auth
import tornado.escape
import tornado.httpserver
import tornado.ioloop
import tornado.options
import tornado.web
import Settings
from tornado.options import define, options
@guillaumevincent
guillaumevincent / pip-verification.py
Created March 16, 2013 17:25
Get from http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/ Pip has an option to upgrade a package (_pip install -U_), however it always downloads sources even if there is already a newest version installed. If you want to check updates for all installed packages then some scripting is required. This s…
#!/usr/bin/env python
import xmlrpclib
import pip
pypi = xmlrpclib.ServerProxy('http://pypi.python.org/pypi')
for dist in pip.get_installed_distributions():
available = pypi.package_releases(dist.project_name)
if not available:
# Try to capitalize pkg name
html, body{
height: 100%;
}
body {
background: rgb(245,245,245);
font-family: arial,sans-serif;
}
input {
padding: 10px;
display: block;