Skip to content

Instantly share code, notes, and snippets.

View guillaumevincent's full-sized avatar

Guillaume Vincent guillaumevincent

View GitHub Profile
@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 / login.html
Last active December 1, 2020 01:26
Basic authentication on Tornado with a decorator
<div id="main-container">
<div id="main">
<h1>
<img alt="scubabook logo" src="{{ static_url("img/logo.png") }}">
</h1>
<div id="login-form">
<form action="/auth/login/" method="post" id="login_form">
<fieldset>
<label for="username">Username</label>
<input autocapitalize="off" autocorrect="off" class="text-input" id="username" name="username" tabindex="1" type="text" value="">
@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;
@guillaumevincent
guillaumevincent / button.styl
Created November 12, 2013 15:16
Button stylus and jade test
red = #DC2E2D
white = #FFFFFF
green = #3C8F48
blue = #2A6BEB
orange = #F3A527
black = #000000
grey = #848484
dark = #111111
darkblue = #303886
cyan = #3893B4
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@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 / installation.md
Last active October 28, 2023 12:05
A simple guide to install PyQt5 on Mac OS X 10.9 (Maverick) and use python 3.4 on a virtualenv.

Guide to install PyQt5 on Mac OS X with python 3.4 virtualenv

Description

A simple guide to install PyQt5 on Mac OS X 10.9 (Maverick) and use python 3.4 on a virtualenv.

Requirements

  • xcode 5.1.1
  • python 3.4.0
  • Qt libraries 5.2.1
@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