Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

var child_process = require('child_process');
var LineInputStream = require('line-input-stream');
var sensorex = LineInputStream(child_process.spawn('./sensorex'));
sensorex.setEncoding("utf8");
sensorex.setDelimiter("\n");
sensorex.on('line', function(line) {
console.log('New Line: ' + line);
@bencevans
bencevans / Emoticons.txt
Created July 4, 2013 14:41
FB Emoticons
smile
:-)
frown
:-(
tongue
:-P
grin
:-D
gasp
:-O
@bencevans
bencevans / exec.js
Last active December 8, 2022 05:00
Music Reddits Scrape
// http://www.reddit.com/r/Music/wiki/musicsubreddits
var musicReddits = $('a').filter(function() { return $(this).text().match(/^\/r\//); });
// array
musicReddits.map(function() { return $(this).text(); }).toArray();
// console.log
@bencevans
bencevans / tom
Created June 16, 2013 19:33
Tomahawk (DBUS) CLI
#!/bin/bash
# Credit to azzid for Spotify version - http://ubuntuforums.org/showthread.php?t=1797848
# Collect DBUS_SESSION_BUS_ADDRESS from running process
function set_dbus_adress
{
USER=$1
PROCESS=$2
PID=`pgrep -o -u $USER $PROCESS`
@bencevans
bencevans / index.js
Created June 5, 2013 19:49
@gifs Tweets 2 Images
$('.tweet').each(function() {
if($(this).find('.username').text() == '@GIFs') {
var el = $(this).find('.tweet-text');
el.html('<img style="max-width: 100%;" src="' + el.text() + '" alt="' + el.text() + '"/>');
}
});
@bencevans
bencevans / index.js
Created May 26, 2013 11:54
If Google Chrome/Chromium
/**
* Is Google Chrome/Chromium?
*/
if(window && window.chrome) {
// Load the magic
} else {
// D'oh!
}
@bencevans
bencevans / server.js
Created May 16, 2013 12:24
SOCKSio net SOCKS4a Proxy Server Helper
/**
* Module Dependencies
*/
var net = require('net'),
EventEmitter = require('events').EventEmitter,
util = require('util');
/**
* SOCKS Server Wrapper for a net stream
@bencevans
bencevans / build.sh
Last active December 17, 2015 07:19
Ubuntu 13.04 Tomahawk Build
sudo apt-get update
sudo apt-get install -y python-software-properties
sudo add-apt-repository -y ppa:tomahawk
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get install -y libechonest-dev libfftw3-dev libsamplerate0-dev libgsasl7-dev subversion build-essential cmake libtag1c2a libtag1-dev libqt5-dev libqt5-sql-sqlite \
libphonon-dev libboost-dev libboost-thread-dev zlib1g-dev libgnutls-dev libz-dev \
libqjson-dev libattica-dev libqca2-dev libx11-dev pkg-config libqca2-plugin-ossl git-core libspeex-dev # phonon-backend-vlc
cd ~
@bencevans
bencevans / teapot.js
Created May 5, 2013 09:08
'I'm a teapot' node.js server
var http = require('http');
var server = http.createServer(function(req, res) {
res.statusCode = 418;
res.end('I\'m a teapot');
});
server.listen(process.env.PORT || 3000);
@bencevans
bencevans / dabblet.css
Created April 2, 2013 21:40
CSS3 Loading with Window (Chrome)
/**
* CSS3 Loading with Window (Chrome)
*/
body {
background-color: #111;
}
.container {
margin: 100px auto;