Skip to content

Instantly share code, notes, and snippets.

flags = %{
default: 0,
sourcepos: 1,
hardbreaks: 2,
normalize: 4,
smart: 8,
validate_utf8: 16,
safe: 32
}
@tvon
tvon / eval_in_file.rb
Created January 7, 2014 21:57
Dump code to be eval'd in a file so as to get a useful traceback if/when it fails.
def eval_in_file(source, options={})
suffix = options[:suffix] || Time.now.strftime("%s%N")
path = options[:path] || "/tmp/"
result = nil
filename = "#{path}eval-#{suffix}.rb"
file = File.new(filename, 'w+')
file.write(source)
file.rewind
begin
#!/usr/bin/env bash
NGINX=/usr/sbin/nginx
DIRECTIVES="worker_processes 1; pid /var/run/nginx-${USER}.pid; error_log /dev/null;"
# nginx attempts to write to the default logfile location despite the passed directive, so grep those errors out
# (note that I may just be doing something stupid and not properly setting the directive)
$NGINX -t -c $1 -g "$DIRECTIVES" 2>&1 | grep -v '^nginx: '
activate() {
if [ $# -eq 0 ];
then
if [ -f .nix ];
then
nix-shell .nix -A localEnv
else
echo '.nix file not found' 1>&2
fi
else
-- Build files have been written to: /tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/stubdom/tpm_emulator-x86_64/build
touch tpm_emulator-x86_64
/tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/wget/wget -c -O gmp-4.3.2.tar.bz2 \/tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/stubdom/../xen_ext_files/gmp-4.3.2.tar.bz2
===== Not fetching -c -O gmp-4.3.2.tar.bz2 /tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/stubdom/../xen_ext_files/gmp-4.3.2.tar.bz2, copy pre-fetched file instead [6693/72580]
tar xjf gmp-4.3.2.tar.bz2
rm gmp-x86_64 -rf || :
mv gmp-4.3.2 gmp-x86_64
#patch -d gmp-x86_64 -p0 < gmp.patch
cd gmp-x86_64; CPPFLAGS="-isystem /tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/stubdom/cross-root-x86_64/x86_64-xen-elf/include -isystem /tmp/nix-build-xen-4.5.2.drv-0/xen-4.5.2/stubdom/../extras/mini-os/include -D__MINIOS__ -DHAVE_LIBC -isystem /tmp/nix-
==> Reinstalling neovim/neovim/neovim
==> Cloning https://github.com/neovim/neovim.git
Updating /Library/Caches/Homebrew/neovim--git
git config remote.origin.url https://github.com/neovim/neovim.git
git config remote.origin.fetch +refs/heads/master:refs/remotes/origin/master
git fetch origin
==> Checking out branch master
git checkout -f master --
Your branch is up-to-date with 'origin/master'.
git reset --hard origin/master
provider "docker" {
host = "tcp://192.168.99.100:2376/"
}
## Containers
resource "docker_container" "flexo-gogs" {
image = "${docker_image.gogs.latest}"
name = "flexo-gogs"
}
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file contains the mappings for a Microsoft Xbox One Controller to actions within XBMC -->
<!-- The drivers for Linux and Windows do not always match. Mappings for Win32 will be presented -->
<!-- first, with Linux alts second. -->
<!-- The <global> section is a fall through - they will only be used if the button is not -->
<!-- used in the current window's section. Note that there is only handling -->
<!-- for a single action per button at this stage. -->
<!-- The format of a mapping is: -->
<!-- <device name="name"> -->
@tvon
tvon / kristol-memo.markdown
Created March 3, 2009 19:04
"Bill Kristol’s 1993 Memo Calling For GOP To Block Health Care Reform" converted to Markdown format from sources here: http://is.gd/lAKi

Defeating President Clinton's Health Care Plan

What follows is the first in what will be a series of political strategy memos prepared by The Project for the Republican Future. The topic of this memo is President Clinton's health care reform proposal, the single most ambitious item on the Administration's domestic policy agenda.

These four pages are an attempt to describe a common political strategy for Republicans in response to the Clinton health care plan. By examining the president's own strategy and tactics, this memo suggests how Republicans might reframe the current health care debate, offer a serious alternative, and, in the process, defeat the president's plan outright.

Nothing in these pages is intended to supplant the many thoughtful analysis of the Clinton health care plan already produced by republican and others, analyses which have done much to expose both its glaring weaknesses and immediate dangers. In fact, this memo borrows heavily from articles and papers prepared by conserva

@tvon
tvon / Dockerfile
Last active February 9, 2017 22:07
minikube-iso-builder
FROM golang:1.6
RUN dpkg --add-architecture i386 \
&& apt-get -q update \
&& apt-get -q -y upgrade \
&& apt-get -y install \
automake \
bc \
build-essential \
bzr \