Skip to content

Instantly share code, notes, and snippets.

@almorel
almorel / awk_col_ligne
Created October 28, 2011 18:55
awk - colonne en ligne
ps aux|awk '{gsub(/\n/,"");printf("%s,",$2);}'
from Tkinter import *
import Image #PIL
import ImageTk #PIL
import sys
import getopt
try:
if len(sys.argv) == 1:
raise ValueError, "No image filename specified"
@almorel
almorel / gist:1324367
Created October 29, 2011 12:01
AWK - Supprimer les commentaires
awk '$0 !~ /^#/' ./monFichier
@almorel
almorel / gist:1324368
Created October 29, 2011 12:01
AWK - Supprimer lignes en doubles
cat FICHIER |awk '!x[$0]++'
@almorel
almorel / gist:1324369
Created October 29, 2011 12:02
AWK - Afficher lignes entre deux chaines
awk '/regexp1/,/regexp2/' monFichier
@almorel
almorel / python-mersenne.py
Created June 1, 2012 15:21
Nombre de Mersenne
import math
for i in range(100):
print pow(2,i)-1
@almorel
almorel / cam.py
Created August 25, 2012 13:07
List Cam Table of Juniper EX4200
#!/usr/bin/env python
from pysnmp.entity.rfc3413.oneliner import cmdgen
import re
import struct
import getopt
import sys
import signal
OID_BRIDGE=(1,3,6,1,2,1,17,1,4,1,2)
@almorel
almorel / qrencode.py
Created August 25, 2012 13:16
Créer un qrcode
# -*- coding:utf-8 -*-
import qrcode
import getopt
import sys
def usage():
print "usage : qrencode.py -m MESSAGE -save=FILE"
print "-m = Message à encoder"
print "-s = Fichier à enregistrer"
@almorel
almorel / reminder.py
Created November 13, 2012 16:05
Python persistance des données
import pickle
import datetime
# Store the time
pickle.dump( datetime.datetime.now(), open( "last.p", "wb" ) )
# Retreive the last time
previous_time=pickle.load( open( "last.p", "rb" ) )
#include <stdio.h>
#include <stdint.h>
#include <time.h>
int64_t timespecDiff(struct timespec *timeA_p, struct timespec *timeB_p)
{
return ((timeA_p->tv_sec * 1000000000) + timeA_p->tv_nsec) -
((timeB_p->tv_sec * 1000000000) + timeB_p->tv_nsec);
}