Skip to content

Instantly share code, notes, and snippets.

View jpillora's full-sized avatar
👶

Jaime Pillora jpillora

👶
View GitHub Profile
@jpillora
jpillora / authorize-key.sh
Created March 14, 2016 02:58
Authorize jpillora
#!/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 March 11, 2016 10:55
Download and install latest openvswitch
#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 March 11, 2016 05:08
small generic Go (golang) docker file (~11MB)
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 February 22, 2016 01:37
another event source golang example
package main
import (
"fmt"
"log"
"net/http"
"time"
"github.com/NYTimes/gziphandler"
"github.com/donovanhide/eventsource"
@jpillora
jpillora / index.html
Created February 21, 2016 07:20
Complete server-send events (event source) example in Go (golang)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>event source test</title>
</head>
<body>
<div id="events">
</div>
package main
import (
"encoding/binary"
"log"
"strconv"
)
func main() {
msg := "01011100000010101000000010011010000000100110100000001001101000000010011000101111100000001001100010111000101111001011111000000010011010000000100110100000001001100010111000101110001000001000000010011001011100010111001000000010011000101110010111000000101010000000100110100000001001101000000010011000101110001011100010111110000000100110001011100010111100101111100000001001101000000010011010000000100110100000001001100010000010000000100110001011100101110001011100100000001001100010111001011100000010101000000010011000101110001011100010111110110100101011110010111110000000100110001011100010111110110100101011110101110010000000100110100000001001101000000010011000101110001011100010111110101111001000000110000001011100100000001001100010111001011100101011110110000001011100000010100010111000101110001011110010111000101111100000001001100010111110000000100110001011100010111110000000100110001011100010111100101110011111000101111110000000100110100000
@jpillora
jpillora / 0_reuse_code.js
Created February 1, 2016 04:40
Here are some things you can do with Gists in GistBox.
// 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 March 2, 2021 09:56
Install and run tinc-1.1pre11 on Raspberry Pi 2 (Raspberrian)
# 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)
@jpillora
jpillora / nginx-gitlab.conf
Created August 21, 2015 01:36
Gitlab go get via SSH
server {
listen {PUBLIC-GITLAB-HTTP-PORT}; #e.g. 80
server_name {PUBLIC-GITLAB-HOST}; #e.g. git.mycompany.com
# add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
location / {
## Hack to implement && - Concat two strings and compare result
if ($args ~* "^go-get=1") {
set $condition goget;
}
@jpillora
jpillora / myprog.plist
Last active August 29, 2015 14:26
Sample launchd startup plist (for starting Mac OSX terminal programs at boot)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<!-- put this file in /Library/LaunchDaemons/ for root prgrams and ~/Library/LaunchAgents/ for user programs -->
<plist version="1.0">
<dict>
<key>Label</key>
<string>myprog</string>
<key>WorkingDirectory</key>
<string>/tmp/</string>
<key>Program</key>