Skip to content

Instantly share code, notes, and snippets.

View jbarnette's full-sized avatar

John Barnette jbarnette

View GitHub Profile
@zserge
zserge / kvm-host.c
Last active November 16, 2023 04:43
Tiny KVM host to at least partially run Linux kernel
#define _GNU_SOURCE
#include <asm/bootparam.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/kvm.h>
#include <linux/kvm_para.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>

ELF

ELF Header

The first portion of any ELF file is the ELF header. This generally provides offsets to other headers (program headers and section headers) within an ELF.

typedef struct {
  unsigned char e_ident[EI_NIDENT];
 uint16_t e_type;
<textarea style="height: 100%; width: 100%; background: #222; padding: 5% 25%; color: #eee;"></textarea>
@rtomayko
rtomayko / testlib.sh
Last active April 29, 2022 07:23
Simple shell command language test library.
#!/bin/sh
# Usage: . testlib.sh
# Simple shell command language test library.
#
# Tests must follow the basic form:
#
# begin_test "the thing"
# (
# set -e
# echo "hello"
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
require 'minitest/unit'
require 'drb'
require 'rinda/tuplespace'
module MiniTest
class ParallelRunner < MiniTest::Unit
URI = 'druby://127.0.0.1:12345'
def _run_suites suites, type
hash = Hash[suites.map { |s| [s.name, s] }]
@cypriss
cypriss / README.md
Last active June 18, 2018 11:57
Rails 2.3.14 Ruby 1.9.3 - Monkey Patches

How we upgraded UserVoice, a Rails 2.3.14 app, to Ruby 1.9.3.

Blog post here

@foca
foca / singleton.coffee
Created January 18, 2012 22:39
Small implementation of Singletons for Backbone
# Public: generates a mixable singleton implementation dependent on a model key.
# Once you mix it into a model, your model gains an .instance method that will
# generate an object and cache it. Further calls to the .instance methods will
# return the same object.
#
# key - The name of the attribute we use to index instances. Defaults to "id".
#
# Example
#
# # Called without arguments uses the "id" as key.
@cicloid
cicloid / ubuntu-11.10-gems.erb
Created October 28, 2011 22:49
Ubuntu 11.10 Chef Bootstrap with RBEnv
bash -c '
<% if knife_config[:bootstrap_proxy] -%>
(
cat <<'EOP'
<%= "proxy = #{knife_config[:bootstrap_proxy]}" %>
EOP
) > ~/.curlrc
<% end -%>
if [ ! -f /usr/bin/chef-client ]; then
@gruber
gruber / gist:1063574
Last active April 15, 2024 20:00
Walken in LA: Hot Dogs

By Christopher Walken

Do you enjoy eating hot dogs? I hope you won’t be put off by my frankness when I tell you that I absolutely love them. In fact, I enjoy no food item more than a freshly-boiled hot dog. Now, I’ve done a lot of movies, and it’s true that I’ve worked with quite a few celebrities who did not share this opinion. I’m sorry to say that these people have always angered me.

There are two types of people in this world: those who eat hot dogs whenever it is possible to do so, and those who opt to do other things with their free time. Who do the latter think they are kidding? What pastime could be more rewarding than the consumption of hot dogs? I haven’t yet found one, and I don’t expect to in my lifetime. Unlike other foods, hot dogs can be eaten at any time, in any place, and it is not necessary to cook them. Now, I ask you: Why not eat hot dogs? They are delicious.

I carry a bag of hot dogs with me wherever I go. I eat them from the bag whenever I get the urge, regardless of the circumstances