This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from PIL import Image | |
| def extractFrames(inGif, outFolder): | |
| frame = Image.open(inGif) | |
| nframes = 0 | |
| while frame: | |
| frame.save( '%s/%s-%s.gif' % (outFolder, os.path.basename(inGif), nframes ) , 'GIF') | |
| nframes += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| REM BE CAREFUL ! this removes explorer.exe from your windows default config ! | |
| REM you have to reboot for this to take effect | |
| @echo off | |
| reg add "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon" /V Shell /t REG_SZ /d "FullPathToYourApp.exe" /f |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/python | |
| # transform any XML with a XSLT | |
| # you can pass additional parameters for your stylesheet | |
| def xsl_transformation(xslfile, xmlfile = None, xmlstring = None, params={}): | |
| from lxml import etree | |
| import StringIO | |
| xslt_tree = etree.XML(utils.readfile(xslfile)) | |
| transform = etree.XSLT(xslt_tree) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def validRIB(banque, guichet, compte, cle): | |
| # http://fr.wikipedia.org/wiki/Clé_RIB#V.C3.A9rifier_un_RIB_avec_une_formule_Excel | |
| import string | |
| lettres = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
| chiffres = "12345678912345678923456789" | |
| # subst letters if needed | |
| for char in compte: | |
| if char in string.letters: | |
| achar = char.upper() | |
| achiffre = chiffres[lettres.find(achar)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def validInsee(insee, cle): | |
| # http://fr.wikipedia.org/wiki/Numero_de_Securite_sociale#Unicit.C3.A9 | |
| # gestion numeros corses | |
| insee = insee.replace('A', 0) | |
| insee = insee.replace('B', 0) | |
| reste = int(insee) % 97 | |
| return ((97 - reste) == int(cle)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ceci extraira en jpg la premiere image de la video test.mpg | |
| vlc.exe -V image --start-time 0 --stop-time 1 --image-out-format jpg --image-out-ratio 24 --image-out-prefix snap test.mpg vlc://quit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| find . -type f -exec wc -l "{}" \; | awk ' { sum += $1 } END {print sum}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // to capture ALL events use: | |
| Ext.util.Observable.prototype.fireEvent = | |
| Ext.util.Observable.prototype.fireEvent.createInterceptor(function() { | |
| console.log(this.name); | |
| console.log(arguments); | |
| return true; | |
| }); | |
| // to capture events for a particular component: | |
| Ext.util.Observable.capture( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // from http://www.xpertdeveloper.com/2011/09/get-real-ip-address-using-php/ | |
| if (!empty($_SERVER["HTTP_CLIENT_IP"])) | |
| { | |
| //check for ip from share internet | |
| $ip = $_SERVER["HTTP_CLIENT_IP"]; | |
| } | |
| elseif (!empty($_SERVER["HTTP_X_FORWARDED_FOR"])) | |
| { | |
| // Check for the Proxy User |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| # use builtin PHP tokenizer to convert opening tags | |
| # based on http://stackoverflow.com/questions/684587/batch-script-to-replace-php-short-open-tags-with-php/1647429#1647429 | |
| function convert($file) { | |
| $content = file_get_contents($file); | |
| $tokens = token_get_all($content); | |
| $output = ''; | |
| foreach($tokens as $token) { |