View phantomjs-netsniff.js
if (!Date.prototype.toISOString) {
Date.prototype.toISOString = function () {
function pad(n) { return n < 10 ? '0' + n : n; }
function ms(n) { return n < 10 ? '00'+ n : n < 100 ? '0' + n : n }
return this.getFullYear() + '-' +
pad(this.getMonth() + 1) + '-' +
pad(this.getDate()) + 'T' +
pad(this.getHours()) + ':' +
pad(this.getMinutes()) + ':' +
pad(this.getSeconds()) + '.' +
View get_title_and_url.applescript
# Keep in mind that when asking for a `return` after another, only the first one will be output.
# This example is meant as a simple starting point, to show how to get the information in the simplest available way.
# Google Chrome
tell application "Google Chrome" to return URL of active tab of front window
tell application "Google Chrome" to return title of active tab of front window
# Google Chrome Canary
tell application "Google Chrome Canary" to return URL of active tab of front window
tell application "Google Chrome Canary" to return title of active tab of front window
# Chromium
View vscode.user.setting.json
// Place your settings in this file to overwrite the default settings
{
"workbench.colorTheme": "Monokai Dimmed",
"window.zoomLevel": 1,
"workbench.statusBar.visible": false,
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
View horizontal-infinite-carousel.html
View MagickWand-sucks.md

Wand==0.3.7, Python 3.4.3, OSX EI Capitan 10.11

when run from wand.image import Image it throw errors:

ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: brew install freetype imagemagick

ok, first I try this:

View tcp_proxy.js
var net = require('net');
var socket = net.connect({
port: 55555 // ssh -N -D 0.0.0.0:55555 localhost
},function() {
console.log('connected to ssh socks server!');
var server = net.createServer(function(client) {
client.pipe(socket);
});
server.listen(1080, '127.0.0.1');
View Global keyboard hook for OSX
// alterkeys.c
// http://osxbook.com
//
// Complile using the following command line:
// gcc -Wall -o alterkeys alterkeys.c -framework ApplicationServices
//
// You need superuser privileges to create the event tap, unless accessibility
// is enabled. To do so, select the "Enable access for assistive devices"
// checkbox in the Universal Access system preference pane.
View node-tail-f.js
var express = require('express'), spawn = require('child_process').spawn;
var app = express.createServer();
app.use(app.router);
var tail;
app.get('/tail', function(req, res) {
res.header('Content-Type','text/html;charset=utf-8');
tail = spawn('tail', ['-f', './test.log']);
View routes.rb
admin_constraint = lambda do |request|
request.env['warden'].authenticate? and not request.env['warden'].user.nil?
end
constraints admin_constraint do
mount Logster::Web, at: "/logs"
end
View recursive_test.rb
@max_count = 5
def recursive_test(p1)
begin
if @max_count > 1
raise "test"
else
@max_count + p1
end
rescue