Skip to content

Instantly share code, notes, and snippets.

View ibaaj's full-sized avatar

Ismaïl Baaj ibaaj

  • Paris, France
View GitHub Profile
@ibaaj
ibaaj / Rgb2hsv in Coffeescript
Created February 6, 2014 11:20
Rgb2hsv in Coffeescript
rgb2hsv (r,g,b) ->
r=r/255
g=g/255
b=b/255
max = Math.max(r,g,b)
min = Math.min(r,g,b)
v = max
d = max - min
@ibaaj
ibaaj / parsing_essentia_yaml_export.js
Last active August 29, 2015 13:57
Parsing essentia yaml export - find . -name "*.yaml" -exec node conv.js {} \;
yaml = require('js-yaml');
fs = require('fs');
try {
var doc = yaml.safeLoad(fs.readFileSync(process.argv[2], 'utf8'));
var nLine = process.argv[2] + ','
+ doc.metadata.audio_properties.length + ','
+ doc.rhythm.bpm + ','
@ibaaj
ibaaj / laptop.local.linux
Last active August 29, 2015 14:05
throughbot/laptop
#!/bin/sh
sudo add-apt-repository ppa:webupd8team/atom
sudo add-apt-repository ppa:jon-severinsson/ffmpeg
sudo add-apt-repository ppa:jerzy-kozera/zeal-ppa
sudo apt-get update
sudo apt-get install atom
sudo apt-get install mongodb
sudo apt-get install npm
sudo apt-get install node
sudo npm install -g coffee-script
@ibaaj
ibaaj / pageMonitor.js
Last active August 29, 2015 14:06
Page Monitor NodeJS - usage: node pageMonitor.js http://url.com/ 300
var http = require('http');
var url = require("url");
var crypto = require('crypto');
if(process.argv.length != 4)
{
console.log('Syntax ::');
console.log('node pagemonitor.js http://my-url-to-monitor.com 300');
console.log('with 300 the interval check (in seconds (300s = 5min)).');
process.exit(1);
@ibaaj
ibaaj / auto.js
Created November 3, 2014 02:57
game.ioxapp.com/color/
setInterval(function(){
var list = document.getElementById("box").getElementsByTagName("span"), bgUsed={};
for (var i = 0, len = list.length; i < len; i++) {
var e = list[i].style.backgroundColor;
if(Object.keys(bgUsed).length==0){bgUsed[e]=i; continue;}
if(!bgUsed.hasOwnProperty(e)) {bgUsed[e]=i; continue; }
else if(Object.keys(bgUsed).length > 1) { delete bgUsed[e]; break;}
}
@ibaaj
ibaaj / twitter-block.py
Created November 11, 2014 01:44
Twitter block a list of user with TwitterAPI
import codecs
from datetime import datetime
import sys
from TwitterAPI import TwitterAPI, TwitterOAuth, TwitterRestPager
###Supposed you have a large list of username like this in a txt file (here: o.txt) :
###@aaaa
###@bbbb
###@cccc
###....
@ibaaj
ibaaj / grabber.py
Last active August 29, 2015 14:16
facebook Graph online people / hour
import sys
import os
import urllib2
import json
import urllib
from time import strftime, sleep
def write_to_file(data):
if os.path.exists("fb_data.txt"):
@ibaaj
ibaaj / unfollow.js
Created June 14, 2015 12:00
Unfollow all pages i've liked on facebook - Go to https://www.facebook.com/[YOURUSERNAME]/likes & Scroll down to show all pages & execute this script in the console
counter=0; var ids = [];
for(var i=0; i < document.getElementsByClassName('_42ft _4jy0 _5lzj _3spg _4jy3 _517h _51sy').length; i++){
var d = document.getElementsByClassName('_42ft _4jy0 _5lzj _3spg _4jy3 _517h _51sy')[i];
if(!/hidden_elem/g.test(d.className)){
counter++;
ids.push(i);
}
}
console.log(counter);
@ibaaj
ibaaj / MITM -SSL-Proxies.md
Created December 7, 2015 03:55 — forked from jeremiahsnapp/MITM -SSL-Proxies.md
Man In The Middle (MITM) SSL Proxies - Simple ways to see traffic between an SSL server and client in clear text.

HTTP(S) specific MITM SSL Proxies

mitmproxy

mitmproxy is an excellent console app written in Python.

It is easy to use on Linux and OS X.

Use brew install mitmproxy to install it on OS X.

@ibaaj
ibaaj / Edge Element stopped at its percentage seen in viewport
Created January 24, 2014 14:32
snippet of code working with skrollr to stop a Adobe Edge Composition at a defined timeline according to its percentage seen in viewport
function percentageSeen (id) {
var $element = $('#'+id), $win = $(window),viewportHeight = $(window).height(),
scrollTop = $win.scrollTop(),
elementOffsetTop = $element.offset().top,
elementHeight = $element.height();
if (elementOffsetTop > (scrollTop + viewportHeight)) {
return 0;