Skip to content

Instantly share code, notes, and snippets.

@PeterHancock
PeterHancock / 1.md
Last active December 16, 2015 19:59
gist.io blog
mkdir ~/app-root/data/tmp
mysqldump -h $OPENSHIFT_MYSQL_DB_HOST -P ${OPENSHIFT_MYSQL_DB_PORT:-3306} -u ${OPENSHIFT_MYSQL_DB_USERNAME:-'admin'} --password="$OPENSHIFT_MYSQL_DB_PASSWORD" --all-databases > ~/app-root/data/tmp//all.sql
@PeterHancock
PeterHancock / OauthTest.groovy
Last active December 20, 2015 12:29
OAUTH client
@GrabConfig(systemClassLoader=true)
@GrabResolver(name='org.climatic', root='http://dl.bintray.com/content/climatic/climatic')
@Grab('com.sun.jersey:jersey-core:1.10')
@Grab('com.sun.jersey:jersey-client:1.10')
@Grab('com.sun.jersey.contribs.jersey-oauth:oauth-signature:1.10')
@Grab('com.sun.jersey.contribs.jersey-oauth:oauth-client:1.10')
@Grab('org.climatic:climatic-core:0.1.2')
import com.sun.jersey.api.client.Client
import com.sun.jersey.api.client.ClientResponse
@PeterHancock
PeterHancock / SSH Gist URL
Created August 22, 2013 15:43
ssh gist url
git@gist.github.com:[Gist ID].git
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/three.js/r61/three.min.js"></script>
</head>
<body>
<script>
var camera, scene, renderer;
var geometry, material;
var meshes = [];
@PeterHancock
PeterHancock / asyncInvoke.js
Created February 28, 2014 13:04
async shotgun
//cmd.js
exports.invoke = function(shell, options) {
shell.emit('async', function(resume) {
someAsyncFn(function(result){
shell.log(result);
resume();
});
//app.js
@PeterHancock
PeterHancock / password.js
Created February 28, 2014 13:29
shotgun password
//app.js
var readline = require('readline'), rl = null, ....
function startRl() {
rl = readline.createInterface(process.stdin, process.stdout);
rl.setPrompt('> ');
rl.on('line', function (userInput) {
shell.execute(userInput);
rl.prompt();
@PeterHancock
PeterHancock / README.md
Last active April 23, 2017 18:27
Running a node script on your $PATH with --harmony flag

Running a node script on your $PATH but with the --harmony flag

Some npm packaged scripts are written as frameworks that dynamically require user node scripts, e.g. the gulp CLI script requires the user provided Gulpfile.js (by default).

To write .js using ES6 syntax is problematic; if the $PATH script for a framework x looks like

#!/usr/bin/env node
var x = require('x');

...
alert('A bookmarlet');

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname