Skip to content

Instantly share code, notes, and snippets.

@lambrospetrou
lambrospetrou / node-and-npm-in-30-seconds.sh
Created May 20, 2016 23:16 — forked from isaacs/node-and-npm-in-30-seconds.sh
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
@lambrospetrou
lambrospetrou / gohttp.go
Last active September 13, 2017 21:18
A simple HTTP server to serve a directory instead of python SimpleHTTPServer
// To get the code git clone it as shown below:
// git clone https://gist.github.com/lambrospetrou/7b582954357778a42cc6e98477d32910.git gohttp
//
// Run either by `go run gohttp.go`
// Or do a `go install` and run it from your path directly with `gohttp`
// Example: `gohttp -d someDir/`
package main
import (
"flag"
@lambrospetrou
lambrospetrou / unixhttpc.go
Last active July 8, 2017 10:13 — forked from teknoraver/unixhttpc.go
HTTP over Unix domain sockets in golang
package main
import (
"context"
"flag"
"fmt"
"io"
"net"
"net/http"
"os"
@lambrospetrou
lambrospetrou / command-execution-server.go
Created September 13, 2017 11:21
This server in go allows you to make an HTTP request to an endpoint and pass the body content as STDIN input to a command line script and return the output.
package main
import (
"fmt"
"io/ioutil"
"log"
"net/http"
"os/exec"
)

Install n

git clone https://github.com/tj/n.git
cd n

# install it to a home folder instead of /usr/local
PREFIX=$HOME/local make install
@lambrospetrou
lambrospetrou / keybase.md
Created October 7, 2017 12:35
Keybase.io verification

Keybase proof

I hereby claim:

  • I am lambrospetrou on github.
  • I am lambrospetrou (https://keybase.io/lambrospetrou) on keybase.
  • I have a public key ASAEbUDrWOOF8uJRJ8KryBorw3PBqRKwXttx_jv_Hsb5cgo

To claim this, I am signing this object:

@lambrospetrou
lambrospetrou / quick-sort.rkt
Created November 5, 2017 01:48
Quick-sort implementation in Racket
#lang racket
(define (qsrt iarr lt)
(cond
[(< 1 (length iarr))
(let (
[pivot (first iarr)]
[gt (lambda (l r) (not (or (lt l r) (equal? l r))))])
(append
(qsrt (filter (lambda (x) (lt x pivot)) iarr) lt)
@lambrospetrou
lambrospetrou / csv-to-markdown-table.rkt
Last active November 9, 2017 00:01
CSV to Markdown converter written in Racket
; The first line of the input is considered to be the heading!
; It accepts either one command line argument with the CSV file path
; or it reads the input from `stdin`.
#lang racket
(require csv-reading)
(define (getInputPort)
(cond
[(> (vector-length (current-command-line-arguments)) 0)
#!/bin/bash
set -e
INSTALL_DIR="$HOME/local"
# erlang FROM SOURCE - http://erlang.org/doc/installation_guide/INSTALL.html
# You need to have OpenSSL for :crypto, wxWidgets for :wx, etc.
#ERL_VERSION="20.2"
#wget "http://www.erlang.org/download/otp_src_$ERL_VERSION.tar.gz"
#!/bin/bash
set -e
SOURCE_DIR="the-dir-to-save"
S3_BUCKET="s3://your-s3-bucket/with/path"
TIMENOW="$(date --rfc-3339=seconds | tr ' ' '_' | tr ':' '-' | tr '+' '.')"
FILENAME="$SOURCE_DIR.$TIMENOW.tgz"