from difflib import SequenceMatcher
text1 = "Mais pourquoi la petite sirène est-elle aussi super, ce n'est pas comme les méchants poissons"
text2 = "Il était une fois une petite sirène super méchante qui mangeait des poissons"
matcher = SequenceMatcher(None, text1, text2)
blocks = matcher.get_matching_blocks()
for pos1, pos2, size in blocks:
print(size, pos1, pos2, text1[pos1:pos1+size])
>>> 1 1 5 a
>>> 3 2 15 is
This file contains 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
class Bash(object): | |
@property | |
def out(self): | |
return self._wrapped | |
def __mod__(self, other): | |
self._wrapped = other | |
return self |
This file contains 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
// Handle script with no argument for DEBUG as an artoo bookmarklet | |
if (typeof(arguments) == "undefined") { | |
arguments = [60, 20, 15, function(){console.log("FINISHED!");}]; | |
} | |
(function(endScript, timeout, idle_timeout, ajax_timeout) { | |
var timeout = Math.max(30, timeout) * 1000, | |
idle_timeout = idle_timeout * 1000, | |
ajax_timeout = ajax_timeout * 1000; |
This file contains 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
var sandcrawler = require("sandcrawler"), | |
//artoo = require("sandcrawler/node_modules/artoo-js"), | |
artoo = require("artoo-js"), | |
logger = require("sandcrawler-logger"), | |
fs = require("fs"), | |
data = []; | |
// Declare a plugin | |
var throttle = function(opts) { | |
return function(scraper) { |
This file contains 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
# On lit les headers dans la première ligne des csv | |
headers=$(cat */*/*.csv | head -1) | |
# On réécrit les headers avec nos champs en plus dans le fichier final | |
echo "Lycee,classe,eleve,$headers" > all.csv | |
# On itère sur l'arborescence des dossiers et stocker les noms dans des variables | |
ls | grep Lycée | while read lycee; do | |
ls "$lycee" | while read classe; do | |
ls "$lycee/$classe" | grep ".csv$" | sed 's/\.csv$//' | while read eleve; do |
This file contains 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/env python | |
# -*- coding: utf-8 -*- | |
import os, sys, csv, json | |
from datetime import datetime | |
from pyquery import PyQuery as pq | |
# TODO | |
# - Remove duplicates | |
# - Filtering |
This file contains 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 sys, json | |
from InstagramAPI import InstagramAPI | |
from time import sleep | |
from pprint import pprint | |
#import pandas as pd | |
#import requests, urllib, bs4, ssl, json, sys, re | |
def connect_api(user, password): | |
api = InstagramAPI(user, password) | |
retries = 12 |
This file contains 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/env python | |
import os | |
import sys | |
import csv | |
import json | |
import requests | |
metadata = { | |
"id": None, "desc": None, "createTime": None, "originalItem": None, |
This file contains 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
alarm() { | |
perl -e ' | |
eval { | |
$SIG{ALRM} = sub { die }; | |
alarm shift; | |
system(@ARGV); | |
}; | |
if ($@) { exit 1 } | |
' "$@"; | |
} |
This file contains 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/env python | |
import sys | |
from socket import socket | |
ports = range(int(sys.argv[1]), int(sys.argv[2])) | |
s = socket() | |
for port in ports: | |
try: | |
print "TEST %s..." % port |
OlderNewer