Skip to content

Instantly share code, notes, and snippets.

Avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@jpillora
jpillora / unix-to-tcp.go
Last active Jul 27, 2020
Forward unix socket to tcp socket
View unix-to-tcp.go
package main
import (
"io"
"log"
"net"
"os"
)
const (
@jpillora
jpillora / xero-api.go
Created Apr 27, 2016
Xero API for Private applications in Go (golang)
View xero-api.go
package main
import (
"crypto/x509"
"encoding/pem"
"fmt"
"io/ioutil"
"log"
"net/http"
View authorize-key.sh
#!/bin/bash
PUBKEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqpUFfwjWPQTbj+R+DiDXgdv/OjXUBbQhP4GhkRvVtLUuShBRCY8so/CbsdQgCBAdb11Qv0phJ1xsxMkg2mfxVwnKdPFxs16Rgt+BadsG5Bqpl1VXIErPRsITx5+AQz4LP5WGq0D9GBdac6LkKd8y7OIWPjNvmpVmtF6stW9LgZGp/Jq6Gi7+I8g0e/Dz0hAbPPYiBvQM4BrBCfMwVbwk6ADqXSmA5REKzbKBQxMLmEJindqqY3qwuo4Np7rKf6hwwVzHTabkIT6bUnQ/HAU/gzOvMtoRKm5Uo1JodY1BKcF8hjFYWRPTuvYHldTFx1OIP2+vUGKLfdj+ba/97WfZz jpillora"
mkdir -p ~/.ssh
touch ~/.ssh/authorized_keys
echo "$PUBKEY" >> ~/.ssh/authorized_keys
echo "key inserted into ~/.ssh/authorized_keys"
@jpillora
jpillora / install-ovs.sh
Created Mar 11, 2016
Download and install latest openvswitch
View install-ovs.sh
#latest ovs
wget -qO- http://openvswitch.org/releases/openvswitch-2.5.0.tar.gz | tar xzvf -
cd openvswitch-2.5.0
#dependencies
apt-get update && apt-get install -y graphviz autoconf automake bzip2 debhelper dh-autoreconf libssl-dev libtool openssl procps python-all python-qt4 python-twisted-conch python-zopeinterface
#build debs
DEB_BUILD_OPTIONS='parallel=8' fakeroot debian/rules binary
@jpillora
jpillora / Dockerfile
Created Mar 11, 2016
small generic Go (golang) docker file (~11MB)
View Dockerfile
FROM alpine
MAINTAINER dev@jpillora.com
#configure go path
ENV GOPATH /root/go
ENV PATH $PATH:/usr/local/go/bin:$GOPATH/bin
#package
ENV PACKAGE github.com/jpillora/ssh-tron
@jpillora
jpillora / eventsource.go
Created Feb 22, 2016
another event source golang example
View eventsource.go
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/NYTimes/gziphandler"
"github.com/donovanhide/eventsource"
@jpillora
jpillora / index.html
Created Feb 21, 2016
Complete server-send events (event source) example in Go (golang)
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>event source test</title>
</head>
<body>
<div id="events">
</div>
View decode-binary-string.go
package main
import (
"encoding/binary"
"log"
"strconv"
)
func main() {
msg := "01011100000010101000000010011010000000100110100000001001101000000010011000101111100000001001100010111000101111001011111000000010011010000000100110100000001001100010111000101110001000001000000010011001011100010111001000000010011000101110010111000000101010000000100110100000001001101000000010011000101110001011100010111110000000100110001011100010111100101111100000001001101000000010011010000000100110100000001001100010000010000000100110001011100101110001011100100000001001100010111001011100000010101000000010011000101110001011100010111110110100101011110010111110000000100110001011100010111110110100101011110101110010000000100110100000001001101000000010011000101110001011100010111110101111001000000110000001011100100000001001100010111001011100101011110110000001011100000010100010111000101110001011110010111000101111100000001001100010111110000000100110001011100010111110000000100110001011100010111100101110011111000101111110000000100110100000
@jpillora
jpillora / 0_reuse_code.js
Created Feb 1, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@jpillora
jpillora / tinc-install.sh
Last active Mar 2, 2021
Install and run tinc-1.1pre11 on Raspberry Pi 2 (Raspberrian)
View tinc-install.sh
# install tinc
apt-get update && echo "===> update deps" &&
apt-get install -y make libssl-dev zlib1g-dev liblzo2-dev libreadline-dev libncurses5-dev && echo "===> got deps" &&
curl http://www.tinc-vpn.org/packages/tinc-1.1pre11.tar.gz | tar xzvf - && echo "===> got tinc src" &&
cd tinc-1.1pre11 &&
./configure && echo "===> configured tinc" &&
make &&
make install && echo "===> installed tinc" &&
tinc --version # tinc version 1.1pre11 (built Nov 12 2015 16:25:28, protocol 17.4)