Skip to content

Instantly share code, notes, and snippets.

View ludwig's full-sized avatar

Luis Armendariz ludwig

View GitHub Profile
@ludwig
ludwig / concurrency-in-go.md
Created March 11, 2016 21:23 — forked from kachayev/concurrency-in-go.md
Channels Are Not Enough or Why Pipelining Is Not That Easy
@ludwig
ludwig / certgen.rb
Created April 11, 2016 11:44 — forked from sheerun/certgen.rb
Docker TLS certificate generator
# Generates necessary certificates to ~/.docker
#
# Usage:
# bundle install
# ruby certgen.rb <domain>
require 'certificate_authority'
require 'fileutils'
if ARGV.empty?
import sys
import numpy as np
import matplotlib.pyplot as plt
import theano
import theano.tensor as T
rs = np.random.RandomState(1234)
def gen_spiral(label, dt, n_samples=100, noise=0.1):
"""

Step 1:

Create a statically linked executable.

(I happened to do it in a docker container. You could use any method to create a statically linked executable, really)

Source:

// hello.c

#include

@ludwig
ludwig / Create-branch-with-Github-API.md
Created May 6, 2016 22:28 — forked from Potherca/README.md
Create a branch on Github without access to a local git repo using http://hurl.it/

Ever had the need to create a branch in a repo on Github without wanting (or being able) to access a local repo?

With the aid of [the Github API][1] and [hurl.it][2] this is a piece of cake!

Just follow these steps:

  1. Open [http://hurl.it/][2]
  2. Find the revision you want to branch from. Either on Github itself or by doing a GET request from Hurl: https://api.github.com/repos/<AUTHOR>/<REPO>/git/refs/heads
  3. Copy the revision hash
  4. Do a POST request from Hurl to https://api.github.com/repos///git/refs with the following as the POST body :
@ludwig
ludwig / gist:5d4f1c1dcef09783b53ff515c2300682
Created May 11, 2016 06:06 — forked from rygorous/gist:e0f055bfb74e3d5f0af20690759de5a7
A bit of background on compilers exploiting signed overflow
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those
mysterious cases where it helps?
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but
I think it's useful to know what compiler writers are accomplishing by this.
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some
fairly common cases. The signed overflow UB exploitation is an attempt to work around this.
@ludwig
ludwig / docker-run-ssh.sh
Created May 13, 2016 19:08 — forked from leedm777/docker-run-ssh.sh
Run docker, forwarding your SSH agent into the container
#!/bin/sh
#
# Forwards SSH agent into a Docker container running in the active
# docker-machine
#
PROGNAME=$(basename $0)
NAME=$(docker-machine active)
@ludwig
ludwig / Dockerfile
Created May 14, 2016 17:36 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@ludwig
ludwig / build.sh
Created August 9, 2016 05:28 — forked from patrickarlt/build.sh
ES 7 async/await demo!
babel github-es6.js -o github.js --optional runtime --experimental
@ludwig
ludwig / replify
Created August 21, 2016 08:31 — forked from postpostscript/ replify
replify - Create a REPL for any command
#!/bin/sh
command="${*}"
printf "Initialized REPL for [%s]\n" "$command"
printf "%s> " "$command"
read -r input
while [ "$input" != "" ];
do
eval "$command $input"
printf "\n%s> " "$command"