Skip to content

Instantly share code, notes, and snippets.

require 'open-uri'
require 'json'
album = JSON.parse(open('http://api.deezer.com/2.0/album/302127').read)
album["tracks"]["data"].map { |x| x["preview"] }.join(' ')
@alepez
alepez / led_dim.cpp
Last active December 19, 2015 18:39
// imposta il numero del pin associato al led
int ledPin = 9;
// tiene in memoria il valore
int valore = 0;
void setup() {
// imposta il pin in modalita' OUTPUT
pinMode(ledPin, OUTPUT);
}
@alepez
alepez / Blur.compositor
Last active March 22, 2022 22:05
Ogre3d compositor and glsl shaders for Gaussian blur. It use a combination of horizontal blue and vertical blur.
compositor SceneCameraBlend
{
technique
{
texture scene target_width target_height PF_A8R8G8B8
target scene
{
input previous
}
target scene
@alepez
alepez / alsa.conf
Created June 26, 2013 06:06
/etc/modprobe.d/alsa.conf enable only some devices, by ID or by vendor/product
options snd-usb-audio index=1,15 vid=0x0d8c,0x1d27 pid=0x000c,0x0601 enable=1,0,0
options snd-hda-intel index=0,11,12 id=PCH,NVidia,NVidia_1 enable=1,0,0
@alepez
alepez / midentify.rb
Last active December 18, 2015 21:49
midentify output to hash
def midentify(filename)
data = {}
`midentify "#{filename}"`.split("\n").each do |i|
m = i.split('=')
data[m[0]] = m[1]
end
return data
end
@alepez
alepez / xorg.conf
Created June 20, 2013 15:33
nvidia twinview as ONE monitor, fullscreen
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"
Option "Xinerama" "true"
EndSection
@alepez
alepez / style.cpp
Last active December 18, 2015 12:18
C++ Style
/********** This begin a section **********/
/** This is short comment */
/**
* This is a long long
* long, but very long comment
*/
/**
@alepez
alepez / gist:5780966
Created June 14, 2013 10:46
R: hexadecimal sum modulus 256 (samsung rs232 checksum)
sprintf("%02x", (0x11+0xff+0x01+0x01) %% 256)
@alepez
alepez / jquery.js
Created June 14, 2013 06:13
jquery empty
(function($) {
$(document).ready(function() {
});
})(jQuery)
@alepez
alepez / gist:5774455
Created June 13, 2013 15:08
add ../lib directory relative to script to RUBYPATH
$: << File.expand_path("../lib", File.dirname(__FILE__))