Skip to content

Instantly share code, notes, and snippets.

View isaacs's full-sized avatar
🔮
only way out is through

isaacs isaacs

🔮
only way out is through
View GitHub Profile
@isaacs
isaacs / patriarchy.md
Last active April 8, 2018 01:35
On "Patriarchy" and Homophobia
for i in $HOME/local/*; do
[ -d $i/bin ] && PATH="${i}/bin:${PATH}"
[ -d $i/sbin ] && PATH="${i}/sbin:${PATH}"
[ -d $i/include ] && CPATH="${i}/include:${CPATH}"
[ -d $i/lib ] && LD_LIBRARY_PATH="${i}/lib:${LD_LIBRARY_PATH}"
[ -d $i/lib ] && LD_RUN_PATH="${i}/lib:${LD_RUN_PATH}"
# uncomment the following if you use macintosh
# [ -d $i/lib ] && DYLD_LIBRARY_PATH="${i}/lib:${DYLD_LIBRARY_PATH}"
[ -d $i/lib/pkgconfig ] && PKG_CONFIG_PATH="${i}/lib/pkgconfig:${PKG_CONFIG_PATH}"
[ -d $i/share/man ] && MANPATH="${i}/share/man:${MANPATH}"
@isaacs
isaacs / is-rwx-able.js
Created February 24, 2011 09:49
Test whether or not a file is writable/readable/executable
exports.isReadable = isReadable
exports.isReadableSync = isReadableSync
exports.isWritable = isWritable
exports.isWritableSync = isWritableSync
exports.isExecutable = isExecutable
exports.isExecutableSync = isExecutableSync
function isReadable (path, cb) {
fs.stat(path, function (er, s) {
if (er) return cb(er)
@isaacs
isaacs / file-http-with-stat.js
Created December 21, 2010 21:51
upload a file, and dump the response into a file.
var fs = require("fs")
, http = require("http")
, util = require("sys") // 0.3.x: require("util")
, fileToUpload = "/tmp/request"
, fileToDownload = "/tmp/response"
, server = "example.com"
, port = 80
, path = "/upload/target"
, method = "PUT"
, headers = { "content-type":"text/plain", "accept":"text/html" }
@isaacs
isaacs / sudo.js
Created December 5, 2010 20:14
Usage: sudo.js -u nobody whoami
#!/usr/bin/env node
var args = process.argv.slice(2)
, arg
, requestedUid = 0
, cmd = []
, cmdArgs
, tty = process.binding("stdio")
, path = require("path")
, usage = path.basename(__filename)
@isaacs
isaacs / http-example-client.js
Created December 1, 2010 08:35
a simple example of a nodejs http client making a POST request
var http = require("http")
, util = require("sys") // 0.3.x: require("util")
, fs = require("fs")
, client = http.createClient(80, "example.com")
, request = client.request("POST", "/", {"host":"example.com"})
// send body chunks
request.write("hello, world")
// pump a file through
#!/bin/bash
SERVER=https://api.no.de
SCRIPT="$0"
if [ ${SCRIPT:0:1} == "/" ]; then
SCRIPT="$(basename -- "$SCRIPT")"
fi
main () {
cmd=${1-help}
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active October 9, 2024 01:04
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
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 # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
module.exports = tree
tree.sync = treeSync
var fs = require("fs")
, path = require("path")
function tree (root, cb) {
fs.lstat(root, function (er, s) {
if (er) return cb(er)
s.name = root
@isaacs
isaacs / authorized_keys
Created August 25, 2010 10:13
Mah pubkeys. Autharahz demz.
ssh-dss AAAAB3NzaC1kc3MAAACBAJ6M0r6x1VWmMZL4/QUfIpFX8hJb0z4yyxgkWI1TDYnFNd3lgI4l5zGZQgnyeaL14BoBbiEoIfAAlQ9dzAYYiX7M5STvR543eLY08Ft15T7vmufmE2aAKQhCyb8Q1bHk3rUHeE4l+DzRXirs53s53MbrG/iiYFOb3yieYrbUkRMlAAAAFQDnjodne9N5V4kC/9PLOdS7hSwUxwAAAIAK5iA45rDaMeEfBwpV7W8DyBvVqy7SBe4av8n547YnVM/n762r3vRl/KlCqpyrgH13aH5YktDrWpKAmlqo7vVCLF2zfTMWkXUKiYuojc/jEcJpi1ayOE0Sa5eH3dQJ17Ilc2prLVGS95/6bEl4ZQv+PLujaibcQ+YArkRPsL7xkwAAAIAZ/AbmFPNMamPYjBh6UV1glBnTBdUhNH0SmWFgBgngyWFQq6Y/SVFa1MHLHWFapixNE5g9c6IcdXS1W+N2Xmb7AnJum8oseMjs6VxAH5AQQHllTE15JspeotaBZsgKWFXH5s/gNEC9mOqqtbM0BA+tqVKXN24lVGEEmHqqfcFBsg== isaacs@sistertrain-lm
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA8MAx3/U3aHXuhpuGhge5xMlqLACKgrFHL+F83YU0rP59bzVKk2mkEY7oXw68knzmasiowUBUBA5h0rt2okUp7YP07iaRyx0nnSIt+h8ADXVPLRHURRxEqz1oPD7dis4brUr1Y/v8+sBP4G8BS0f7b/CGqNaAUpOxprBSx7BLgc7m0uC7iYyAVURjuYNDc2c1D7xsh6rXdvEVkdt6gFTBoZh16dxxoZkunBE/pu0ghk0ygyISyWYGr4vU5BII2H9n0Si5vNbNnOvLZeSYaeO9aeDe/bTK8gPQxAHuFzEZhodWThGYfpqFmBUzC1O7klMGnJpkaR3bBFJ/vT78Xi9zJw== isaacs@sistertrain-lm