Skip to content

Instantly share code, notes, and snippets.

@acacio
acacio / telnet.js
Created December 16, 2010 21:42 — forked from ry/telnet.js
#!/usr/bin/env node
// requires node v0.3
// telnet.js 80 google.com
net = require('net');
a = process.argv.slice(2);
if (!a.length) {
console.error("telnet.js port [ host=localhost ]");
process.exit(1);
}
s = require('net').Stream();
var secure = __dirname + "/secure/";
var handler = require('stack')(
require('creationix/log')(),
require('creationix/auth')(/^\/secure\//, require(secure + "users.js")),
require('creationix/static')("/", __dirname, "index.html")
);
var read = require('fs').readFileSync;
var options = {
@acacio
acacio / anchor.js
Created January 9, 2012 21:53 — forked from draeton/anchor.js
Anchor - A URL parsing utility
/**
* Anchor - A URL parsing utility
*
* Copyright 2012, Matthew Cobbs
* MIT licensed
*
* Methods:
*
* getSearchVars - returns a key-value object with the parameters in the URL search
* setSearchVars(o) - sets parameters using a key-value object in the URL search
@acacio
acacio / upnp.js
Created January 12, 2012 21:17
UPNP Port Forwarding for node.js
/* node UPNP port forwarding PoC
This is a simple way to forward ports on NAT routers with UPNP.
This is a not-for-production hack that I found useful when testing apps
on my home network behind ny NAT router.
-satori
usage:
@acacio
acacio / osx_automount_nfs.md
Created December 30, 2015 02:58 — forked from L422Y/osx_automount_nfs.md
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

@acacio
acacio / README.md
Created September 21, 2017 21:29 — forked from magnetikonline/README.md
Bash string manipulation cheatsheet.

Bash string manipulation cheatsheet

Removal
Delete shortest match of needle from front of haystack ${haystack#needle}
@acacio
acacio / golang-tls.md
Created January 23, 2018 23:36 — forked from 6174/golang-tls.md
Simple Golang HTTPS/TLS Examples
Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048
    
# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)
openssl ecparam -genkey -name secp384r1 -out server.key
@acacio
acacio / imgrsz.go
Created April 7, 2018 12:15 — forked from logrusorgru/imgrsz.go
Golang resize png images using different interpolations
package main
import (
"image"
"image/png"
"log"
"os"
"time"
"golang.org/x/image/draw"
@acacio
acacio / haproxy.conf
Created April 23, 2018 09:42 — forked from thpham/haproxy.conf
test config haproxy for gRPC loadbalancing
global
tune.ssl.default-dh-param 1024
defaults
timeout connect 10000ms
timeout client 60000ms
timeout server 60000ms
frontend fe_http
mode http
@acacio
acacio / git-remove-file.sh
Created December 5, 2018 13:45 — forked from bartlomiejdanek/git-remove-file.sh
remove file from git history
#!/bin/bash
set -o errexit
# Author: David Underhill
# Script to permanently delete files/folders from your git repository. To use
# it, cd to your repository's root and then run the script with a list of paths
# you want to delete, e.g., git-delete-history path1 path2
if [ $# -eq 0 ]; then
exit 0