Skip to content

Instantly share code, notes, and snippets.

View revolunet's full-sized avatar
🐫
Killing bugz

Julien Bouquillon revolunet

🐫
Killing bugz
View GitHub Profile
// javascript objects keys method
// from http://javascriptweblog.wordpress.com/2011/02/28/javascript-object-keys-finally/
//all browsers
if (typeof Object.keys != 'function') {
Object.keys = function(obj) {
if (typeof obj != "object" && typeof obj != "function" || obj == null) {
throw TypeError("Object.keys called on non-object");
}
@revolunet
revolunet / apt-add-key.sh
Created March 7, 2011 21:19
add a key to apt-get
#!/bin/sh
gpg --keyserver pgpkeys.mit.edu --recv-key $1
gpg -a --export $1| apt-key add -
echo "done"
@revolunet
revolunet / getInnerText.js
Created March 31, 2011 12:36
get innerText with linebreaks in Firefox. compatible syntaxhighlighter
//
// useful for executing safely embedded syntaxhighlighter code
//
function getInnerText(el, recurse) {
// innerText emulation for Firefox
// pereserve carriage returns
// remove JS comments
var inner = new Array();
if (el.childNodes[0] && el.childNodes[0].nodeValue) {
@revolunet
revolunet / pngmerge.py
Created April 8, 2011 14:20
merge PNGS with alpha channel with PIL
# -*- encoding: UTF-8 -*-
from PIL import Image
import ImageOps
IN = 'bianchi.png'
EKTA = 'ekta.png'
image = Image.open( IN )
ekta = Image.open( EKTA )
@revolunet
revolunet / emailgrabber.py
Last active September 26, 2015 00:28
IMAP email addresses grabber
# -*- encoding: UTF-8 -*-
# grab email addresses from your IMAP inbox
def getHeadersFromEmails(host = 'imap.gmail.com', username = '', password = '', folder = 'INBOX', header = 'FROM', search = 'ALL'):
import imaplib
import re
imap = imaplib.IMAP4_SSL(host, 993)
imap.login(username, password)
mboxes = imap.list()
@revolunet
revolunet / tablet htaccess
Created June 7, 2011 16:45
tablet detection (android/ipad)
#
# redirect requests if not iPad or Android tablet
# NB "mobile safari" is the UA for Android phones
#
RewriteEngine On
SetEnv isAndroidTablet=NO
BrowserMatchNoCase Android isAndroidTablet=YES
BrowserMatchNoCase "Mobile Safari" isAndroidTablet=NO
@revolunet
revolunet / drop-base64.html
Created July 20, 2011 15:10
client side image to base 64 conversion for CSS
<html>
<head>
<script language="javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script language="javascript">
//
// client side image to base64 conversion for your CSS
// from revolunet team - [email protected]
// demo at : http://revolunet.com/static/drop.html
//
$(document).ready(function() {
@revolunet
revolunet / udp.bat
Created July 25, 2011 19:14
VLC UDP stream + httpinterface
REM change UDP IP and port
"c:\program files\videolan\vlc\vlc.exe" "C:\\Users\\juju\\Desktop\\divx\\aymo_brille.avi" --sout="#duplicate{dst=std{access=udp,mux=ts,dst=239.255.12.4:1234}}" --sout-udp-caching=1000 --extraintf=http
@revolunet
revolunet / gist:1104964
Created July 25, 2011 19:30
VLC HTTP stream + intf
REM SERVER (HTTP)
vlc "C:\\Users\\juju\\Desktop\\divx\\aymo_brille.avi" --sout="#duplicate{dst=std{access=http,mux=ts,dst=0.0.0.0:1234}}" --extraintf=http
REM CLIENT
vlc http://SERVERIP:1234 --http-caching=5000
@revolunet
revolunet / gen-images.py
Created July 27, 2011 09:26
generates PNG images from sizes
import Image, ImageDraw, ImageFont
import os
def createImage(width=100, height=50):
size = (width, height)
im = Image.new('RGB', size)
draw = ImageDraw.Draw(im)
color = (100,100,100)