Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

William Bert sandinmyjoints

🏠
Working from home
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am sandinmyjoints on github.
  • I am sandinmyjoints (https://keybase.io/sandinmyjoints) on keybase.
  • I have a public key whose fingerprint is DCAF AC85 B9BC 9906 2005 936A 3837 B7C0 EC44 F56A

To claim this, I am signing this object:

View missing_translations1.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View .eslintrc
{
"plugins": [
"prettier"
],
"extends": [
"eslint:recommended",
"prettier"
],
"env": {
"es6": true,
@sandinmyjoints
sandinmyjoints / page-size.js
Created Jul 6, 2017
Get byte size of gzipped response
View page-size.js
'use strict';
let http = require('http');
let reqOpts = {
host: 'sdlocal.com',
port: 2100,
path: '/'
}
let req = http.request(reqOpts)
View gist:9bf68360056694b87dce484a223dd9ee
# See http://www.markhneedham.com/blog/2013/07/30/netcat-strange-behaviour-with-udp-only-receives-first-packet-sent/
nc -u -l 8125 -w 0 -k
View statsd-echo.js
const dgram = require('dgram');
const server = dgram.createSocket('udp4');
server.on('error', (err) => {
console.log(`server error:\n${err.stack}`);
server.close();
});
server.on('message', (msg, rinfo) => {
console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`);
@sandinmyjoints
sandinmyjoints / nvm_use_if_needed.bash
Created Apr 15, 2016
Call nvm use as needed according to .nvmrc file
View nvm_use_if_needed.bash
function nvm_use_if_needed () {
[[ -r ./.nvmrc && -s ./.nvmrc ]] || return
WANTED=$(sed 's/v//' < ./.nvmrc)
CURRENT=$(hash node 2>/dev/null && node -v | sed 's/v//')
if [ "$WANTED" != "$CURRENT" ]; then
nvm use
fi
}
export PROMPT_COMMAND="$PROMPT_COMMAND ; nvm_use_if_needed"
@sandinmyjoints
sandinmyjoints / index.js
Created Oct 26, 2015
simple node server
View index.js
var http = require('http');
function respond (req, res) {
console.log('request: ' + req.url);
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}
http.createServer(respond).listen(1025, '0.0.0.0');
console.log('Server running at http://0.0.0.0:1025');
View osx-for-hackers.sh
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
red='\033[0;31m'
green='\033[0;32m'
You can’t perform that action at this time.