Skip to content

Instantly share code, notes, and snippets.

Avatar

Ismaïl Baaj ibaaj

  • Paris, France
View GitHub Profile
@ibaaj
ibaaj / BaajAlarm
Last active Nov 15, 2016
prevent from sleeping a Windows computer (and let working an alarm clock program )
View BaajAlarm
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 Jan 24, 2014
snippet of code working with skrollr to stop a Adobe Edge Composition at a defined timeline according to its percentage seen in viewport
View Edge Element stopped at 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 Feb 6, 2014
Rgb2hsv in Coffeescript
View 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 Aug 29, 2015
Parsing essentia yaml export - find . -name "*.yaml" -exec node conv.js {} \;
View parsing_essentia_yaml_export.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 Aug 29, 2015
throughbot/laptop
View laptop.local.linux
#!/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 Aug 29, 2015
Page Monitor NodeJS - usage: node pageMonitor.js http://url.com/ 300
View pageMonitor.js
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 Nov 3, 2014
game.ioxapp.com/color/
View auto.js
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 Nov 11, 2014
Twitter block a list of user with TwitterAPI
View twitter-block.py
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
###....
View .bash_profile
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 Oct 4, 2017 — forked from danielecook/plot_runkeeper.R
Create HeatMap of Runkeeper's data (forked)
View plot_runkeeper.R
find . -type f -name '*.gpx' -print | while read filename; do
echo "$filename";
cat "$filename"|grep " <trkpt"|head -n 1;
done > output.txt
You can’t perform that action at this time.