Skip to content

Instantly share code, notes, and snippets.

@PeterHancock
PeterHancock / tmux.md
Created May 2, 2018 07:47 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
@PeterHancock
PeterHancock / index.js
Created December 15, 2017 10:31
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const delay = (t) => new Promise((resolve, reject) => {
setTimeout(() => resolve(delay.DELAY), t)
})
delay.DELAY = Symbol('DELAY')
@PeterHancock
PeterHancock / index.js
Last active November 14, 2017 13:58
requirebin sketch
const test = require('tape')
const { createStore, combineReducers } = require('redux')
const deepCombineReducers = (reducers) =>
combineReducers(
Object.keys(reducers).reduce(
(acc, key) => {
const reducerOrReducers = reducers[key]
return Object.assign(acc, { [key]: typeof reducerOrReducers === 'function' ? reducerOrReducers : deepCombineReducers(reducerOrReducers) })
// return { ...acc, [key]: typeof reducerOrReducers === 'function' ? reducerOrReducers : deepCombineReducers(reducerOrReducers) }
@PeterHancock
PeterHancock / id_rsa.pub
Created October 16, 2016 11:32
home public key
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDhFfes3sjoOjqa2Q7xnE9LZ+hpa124F7pTgKXLR2Yx5hb9D2ny0PLbnqdQdytJupGPKyaKGsL0m1JjyOaSseqf9W2A8UWXlwwFrIlAzMeJT80vYy7M7AH1LMuLZzoFs0gcyL5PfM9TQ5bU+On5beST0n/PIGb9jlxr4BbfyZ2H6ODXA6+I5qfQzkqtGgUQjA/QFh30WN7sI/JU2PhAWNg5AcmQyrgZ7NXebRfMQIXbziEpdZWLOD81WDQ4Oib7YogLl135WlyzlY7AtrHinsPuzGCv0VdZC3r47GwMSbXYsvUFiU9opxdFtlgGdY/v32RlfCEm1bNsb6y9rBcPkTLB ssh

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
alert('A bookmarlet');
@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');

...
@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 / 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