Skip to content

Instantly share code, notes, and snippets.

@almorel
almorel / example_get_task.py
Created November 18, 2017 12:43 — forked from iomarmochtar/example_get_task.py
Example of fetching Zimbra task and task list (recursive).
__author__ = ('Imam Omar Mochtar', 'iomarmochtar@gmail.com')
from ozpy.mailbox import Mailbox
import sys
from pprint import pprint
import os
"""
Example of fetching Zimbra task and task list (recursively).
"""
@almorel
almorel / ffmpeg_h265.sh
Created August 4, 2017 12:45
ffmpeg - Encode DVD HVEC H265
ffmpeg -i concat:VTS_06_1.VOB\|VTS_06_2.VOB\|VTS_06_3.VOB\|VTS_06_4.VOB\|VTS_06_5.VOB\|VTS_06_6.VOB \
-vsync 1 \
-threads 0 \
-aspect 16:9 \
-map 0:v \
-map 0:3 \
-metadata title="TEST" \
-c:v libx265 \
-preset ultrafast \
-x265-params \
@almorel
almorel / loader.conf
Created March 8, 2016 19:33 — forked from cmabastar/loader.conf
Lenovo X220, freebsd 10.2 settings wireless 6205
iwnfw_load="YES"
if_iwn_load="YES"
iwn6050="YES"
legal.intel_iwn.license_ack=1
wlan_ccmp_load="YES"
wlan_tkip_load="YES"
##semaphore
#sem_load="YES"
#aesni_load="YES"
(ip[2:2] - ((ip[0]&0x0f)*4) - ((tcp[12]&0xf0)*4) != 0) and tcp port 80
@almorel
almorel / curl-format.txt
Created March 2, 2015 14:06
curl -w "@curl-format.txt" -o /dev/null -s http://www.google.fr
Size (bytes):\n
size_download : %{size_download}\n
size_header : %{size_header}\n
size_request : %{size_request}\n
size_upload : %{size_upload}\n
\n
Time (s) :\n
time_namelookup : %{time_namelookup}\n
time_connect : %{time_connect}\n
time_appconnect : %{time_appconnect}\n
import requests
import re
data = requests.get('', cookies={'PHPSESSID': ''})
match=re.search('.*U<sub>n\+1</sub> = \[ (?P<A>[-0-9]+) (?P<a>[+-]) U<sub>n</sub> ] (?P<b>[+-]) \[ n \* (?P<B>[-0-9]+) ]<br />\nU<sub>0</sub> = (?P<C>[-0-9]+)\n<br /> Trouver le terme n&deg;(?P<D>[-0-9]+).*', data.text)
print("Decode equation")
a="U(n+1) = ( " + match.group('A') + " " + match.group('a') + " " + "U(n)" + " ) " + match.group('b') + " ( " + "n" + " " + "*" + " " + match.group('B') + " )"
b="U0="+match.group('C')
c="n="+match.group('D')
#coding: utf-8
from cStringIO import StringIO
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.header import Header
from email import Charset
from email.generator import Generator
import smtplib
# Example address data
@almorel
almorel / uniq_column
Created July 13, 2013 12:23
LibreOffice calc : Count uniq value into one column
=SOMMEPROD((DATA<>"")/(NB.SI(DATA;DATA)+(DATA="")))
@almorel
almorel / gist:5771742
Last active December 18, 2015 10:49
Extraction des statistiques d'un serveur TORQUE/MAUI
# Extract des statistiques TORQUE
cat /opt/torque/serv_priv/accounting/2012*|awk -F ';' '{if ($2 ~ '/E'/){print $4}}'|awk '{for (i=1;i<NF;i++){if ($i ~ '/^Exit\|^resources\|^user\|^group\|^Resource\|^queue/'){printf("%s ", $i);}};print ""}'|python -c 'import sys;a=[elt.rstrip().split(" ") for elt in sys.stdin.readlines()]; b=[["".join(subelt.split("=")[1::]) for subelt in elt] for elt in a];c=[";".join(ligne) for ligne in b];print "\n".join(c);'
#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);
}