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 / BaajAlarm
Last active November 15, 2016 12:21
prevent from sleeping a Windows computer (and let working an alarm clock program )
Config .
powercfg /c BaajAlarm
powercfg /x BaajAlarm /monitor-timeout-ac 15
powercfg /x BaajAlarm /monitor-timeout-dc 15
powercfg /x BaajAlarm /disk-timeout-ac 15
powercfg /x BaajAlarm /disk-timeout-dc 15
powercfg /x BaajAlarm /standby-timeout-ac 0
powercfg /x BaajAlarm /standby-timeout-dc 0
powercfg /x BaajAlarm /hibernate-timeout-ac 0
@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;
@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 / .bash_profile
Created December 30, 2014 00:19
alias
export PATH=/usr/local/bin:$PATH
alias NBContrast="convert $1 -type Grayscale -contrast $2"
alias imgdim='sips -g pixelHeight -g pixelWidth $1'
alias cx='chmod +x'
mcd() { mkdir -p "$1" && cd "$1"; }
qre() { qrencode -o /tmp/a.jpg '$1' && open "/tmp/a.jpg" && sleep 1 && rm "/tmp/a.jpg"; }
alias l='ls -al'
alias dieu='sudo su root -s /bin/zsh'
alias fuck='sudo su root -s /bin/zsh'
export iOSOpenDevPath=/opt/iOSOpenDev
@ibaaj
ibaaj / plot_runkeeper.R
Last active October 4, 2017 08:55 — forked from danielecook/plot_runkeeper.R
Create HeatMap of Runkeeper's data (forked)
find . -type f -name '*.gpx' -print | while read filename; do
echo "$filename";
cat "$filename"|grep " <trkpt"|head -n 1;
done > output.txt