Skip to content

Instantly share code, notes, and snippets.

@csmr
csmr / gist:6300725
Last active December 21, 2015 11:39
How I made node.js play nice on debian wheezy #!
# Note: pasted from command line
umask 022
apt-get update
apt-get install libssl-dev pkg-config build-essential wget gcc g++ checkinstall
mkdir /tmp/node-install
cd /tmp/node-install
# Note: your version number may vary
wget http://nodejs.org/dist/node-latest.tar.gz
tar -zxvf node-v0.10.16.tar.gz
@csmr
csmr / gist:6330892
Last active December 21, 2015 15:59
Put this clunky hack in .screenrc to get screen inside a term inside a ssh -session to scroll up (and after that down, in copy mode) with pageup -key. Del, Esc and Ctrl+A exit copy mode.
bindkey "^[[5~" eval "copy" "stuff ^b" # enter copy mode and move up one page
bindkey -m "^[[5~" stuff ^b # move up one page
@csmr
csmr / proxy.js
Created September 2, 2013 19:03 — forked from mattd/proxy.js
// Usage from some other file:
//
// var app = require('./proxy')({proxyUrl: '//your-remote.com', proxyBase: '/api'})
var path = require('path'),
request = require('request'),
express = require('express'),
app = express();
app.use(express.logger('dev'));
@csmr
csmr / app.js
Created September 2, 2013 19:04 — forked from stenehall/app.js
var passport = require('passport');
var util = require('util');
var GitHubStrategy = require('passport-github').Strategy;
passport.serializeUser(function(user, done) {
done(null, user);
});
passport.deserializeUser(function(obj, done) {
done(null, obj);
@csmr
csmr / gist:6428392
Created September 3, 2013 19:23
Sorensen's "run node as production"
02:27 < sorensen> export NODE_ENV="production"
02:27 < sorensen> exec chpst -u user node /<path>/app.js 2>&1 >> /<path>/process.log
@csmr
csmr / ugly-scope-export.js
Last active December 22, 2015 06:38 — forked from spion/ugly-scope-export.js
Pseudocode for export syntax suga
function exportsToContext() {
var alen = arguments
for (var a = 0; a < alen; a++) {
this.exports[el] = arguments[0][a]);
});
}
var foo = 1, bar = 2, zoo = function() { return "z" };
function export( argArr ) {
@csmr
csmr / install_wally.sh
Last active August 29, 2015 14:15
A OBSOLETED OLD -- go to https://github.com/csmr/jesbang
This is gone, go here to find newest:
https://github.com/csmr/jesbang/
@csmr
csmr / ui.rb
Last active November 23, 2016 09:26
STDIN.read(1) and STDIN.getc reading in multiple characters
# encoding: utf-8
module G
class UI
def initialize
require 'io/console' # for on-key input
@input_buffer = ""
@_debug_frame = 0
ui_run 1
@csmr
csmr / layouts-default.html
Last active December 17, 2016 09:53
Getting a base done for nanoc 4.3.7 site
<article>
<time datetime="<%= @item[:datetime] %>"><%= @item[:time] %></time>
<h1><%= @item[:title] %></h1>
<%= yield %>
</article>
...
<aside id="sidebar">
<h2>Index</h2>
<ul>
<li>
@csmr
csmr / chebustn.text
Created February 12, 2017 21:14
Cachebusting string / version string insertion
I. Some version string
Using clean/smudge filter script
https://git-scm.com/book/en/v2/Customizing-Git-Git-Attributes
Versuiob tagging
http://softwareengineering.stackexchange.com/questions/141973/how-do-you-achieve-a-numeric-versioning-scheme-with-git
Heahd shrot hash
git rev-parse --short HEAD
http://stackoverflow.com/questions/1274605/ruby-search-file-text-for-a-pattern-and-replace-it-with-a-given-value