Skip to content

Instantly share code, notes, and snippets.

View xor-gate's full-sized avatar
👽

Jerry Jacobs xor-gate

👽
View GitHub Profile
@xor-gate
xor-gate / client.go
Created January 7, 2016 12:43 — forked from spikebike/client.go
TLS server and client
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@xor-gate
xor-gate / orhttp_example.go
Created January 24, 2016 13:47 — forked from Yawning/orhttp_example.go
How to dispatch HTTP requests via Tor in Go.
// To the extent possible under law, the Yawning Angel has waived all copyright
// and related or neighboring rights to orhttp_example, using the creative
// commons "cc0" public domain dedication. See LICENSE or
// <http://creativecommons.org/publicdomain/zero/1.0/> for full details.
package main
import (
// Things needed by the actual interface.
"golang.org/x/net/proxy"
@xor-gate
xor-gate / SSHCommander.go
Created January 24, 2016 13:48 — forked from olekukonko/SSHCommander.go
The Nate Shells Out
package main
import (
"fmt"
"os"
"os/exec"
)
type SSHCommander struct {
User string
@xor-gate
xor-gate / gist:d5e5b3ed7557247b7a36
Created January 29, 2016 15:56 — forked from andrewlkho/gist:e9a8c996c4bc1df23cd2
How to secure debian with two factor authentication (TOTP/HOTP)

First, install the necesssary packages:

% apt-get install libpam-oath oathtool

Generate a key and write it to /etc/users.oath (NB the key will be in hexadecimal; if you are using Authy you will want to convert it to BASE32):

% KEY=$( head -c 1024 /dev/urandom | openssl sha1 | awk '{ print $2 }' )
% echo "HOTP/T30/6 andrewlkho - ${KEY}" >> /etc/security/users.oath
% chmod 600 /etc/users.oath
@xor-gate
xor-gate / gofetch.go
Created February 12, 2016 11:07 — forked from marconi/gofetch.go
Downloads file by splitting it into multiple download workers making download faster.
package main
import (
"errors"
"flag"
"fmt"
"io/ioutil"
"log"
"math"
"net/http"
@xor-gate
xor-gate / 01README.md
Last active February 23, 2016 21:36
websocket-jsonrpc-golang

OMG

@xor-gate
xor-gate / _readme.md
Created May 11, 2016 18:51 — forked from steeve/_readme.md
How to cross compile Go with CGO programs for a different OS/Arch

How to cross compile Go with CGO programs for a different OS/Arch

It is possible to compile Go programs for a different OS, even though go build says otherwise.

You'll need:

@xor-gate
xor-gate / gist:5975a645bd8772049866850a92259aac
Created June 11, 2016 14:38 — forked from r3econ/gist:9923319
Downloading JSON file using NSURLSession.
// Create a sample URL.
NSURL *url = [NSURL URLWithString:@"http://www.bbc.co.uk/tv/programmes/genres/drama/scifiandfantasy/schedules/upcoming.json"];
// Create a download task.
NSURLSessionDataTask *task = [[NSURLSession sharedSession] dataTaskWithURL:url
completionHandler:^(NSData *data,
NSURLResponse *response,
NSError *error)
{
if (!error)
@xor-gate
xor-gate / CMakeLists.txt
Created June 13, 2016 09:30
CMake libusb windows
project(stlink C)
cmake_minimum_required(VERSION 3.1)
set (CMAKE_C_STANDARD 99)
include(CheckCCompilerFlag)
find_package(PkgConfig)
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_SOURCE_DIR}/cmake/modules")
file(DOWNLOAD

Blaat

This uses the linux namespaces superpowers to chroot into a rootfs