Skip to content

Instantly share code, notes, and snippets.

Benjamin Ooghe-Tabanou boogheta

Block or report user

Report or block boogheta

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@boogheta
boogheta / instagram.py
Created Jan 14, 2020
Collect users and followers on Instagram with fake InstagramAPI
View instagram.py
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
View parse_factiva_html.py
#!/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
@boogheta
boogheta / assemble.sh
Created Mar 22, 2018
Assemble csv lycées
View assemble.sh
# 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
@boogheta
boogheta / ratio_similarity.md
Created Apr 11, 2017
Calcul de ratio de similarité entre 2 textes avec difflib en python.md
View ratio_similarity.md
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 
@boogheta
boogheta / sandcrawler-test.js
Created Dec 9, 2014
Tryouts with sandcrawler on Libération's articles tagged with "sexe"
View sandcrawler-test.js
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) {
@boogheta
boogheta / scrolldown_and_unfold.js
Created Aug 11, 2014
Scroll and unfold a webpage within PhantomJS or artoo.js
View scrolldown_and_unfold.js
// 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;
View Bash
class Bash(object):
@property
def out(self):
return self._wrapped
def __mod__(self, other):
self._wrapped = other
return self
You can’t perform that action at this time.