Skip to content

Instantly share code, notes, and snippets.

View synaptiko's full-sized avatar

Jiří Prokop synaptiko

View GitHub Profile
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl http://npmjs.org/install.sh | sh
# ~/.moc/themes/monochrome_theme
# Add `Theme = monochrome_theme` to your ~/.moc/config
background = default default
frame = default default
window_title = default default
directory = default default
selected_directory = default default reverse
playlist = default default
selected_playlist = default default reverse
var max = 10,
x = {vs:') versus '};
for (var i=0; i<max; i++) {
console.log('i: ', i);
setTimeout((function(number) { console.log('i(' + i + this.vs + number); }).bind(x), (i * 500), i);
}
@aseemk
aseemk / gist:5574052
Created May 14, 2013 06:21
A homegrown convention for shorthand static access syntax in CoffeeScript.

One of CoffeeScript's best features is the @ shorthand for this -- perfect for accessing instance methods and properties:

class Rectangle
  constructor: (@width, @height) ->
  getArea: ->
    @width * @height

But there's no similar shorthand for accessing static members, e.g. @@. So instead, you're forced to either hardcode class names, or type out the long constructor reference to be generic:

@adammw
adammw / buildnode.sh
Last active March 5, 2016 16:44
Node.js for Raspberry Pi Packaging Script
#!/bin/sh
## Node.js for Raspberry Pi Packaging Script
## =========================================
## Execute this script from within node.js git repo
## Use like this:
## ~/node/$ VERSION=v0.10.0 ./buildnode.sh
if [ -z $VERSION ]; then
echo "set the VERSION first"
exit 1
@dpup
dpup / FastMutex.js
Last active July 28, 2016 07:53
Code snippet for mutual exclusion lock in javascript.
FastMutex.prototype.runInLock = function (callback, opt_context) {
this._setX()
if (!this._isLockAvailable()) {
this._retry(callback, opt_context)
return
}
this._setY()
@eculver
eculver / APPNAME
Created July 5, 2011 17:35 — forked from shimondoodkin/APPNAME
init.d script for node.js for debian
#! /bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@streunerlein
streunerlein / gist:3332181
Created August 12, 2012 14:58
NPM Mirrors & Proxies

Definition

Mirrors: standalone servers with complete copy of npm registry

Proxies: proxy to the database (couchdb) of npm registry, if only the npm registry server fails but the db works

## HowTo See this gist: https://gist.github.com/3331671

Mirrors

(+) means server is self updating (pulls newest stuff from offical registry when back online again)

@mkyral
mkyral / bc-battery_pct.py
Created January 25, 2018 20:48
BigClown - mqtt microservice - convert voltage to percentage
import paho.mqtt.client as mqtt
# Configuration
################
## Server
mqtt_server = "turris"
mqtt_port = 1883
# Core module minimal voltage