Skip to content

Instantly share code, notes, and snippets.

@lstoll
lstoll / config.java
Created July 10, 2012 15:19
JDBC db pooling with DBCP & Heroku
/* based on http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/doc/PoolingDriverExample.java?view=markup
*
* Run this code when your application starts up to create the pool.
*/
// Extract DATABASE_URL environment variable. Set for you on heroku, set it yourself locally
URI dbUri = new URI(System.getenv("DATABASE_URL"));
String username = dbUri.getUserInfo().split(":")[0];
String password = dbUri.getUserInfo().split(":")[1];
String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + dbUri.getPath();
@lstoll
lstoll / github_auth.clj
Created July 25, 2012 22:21
Auth against github in noir app
;; [oauthentic "0.0.6"]
;; [clj-http "0.5.0"]
(ns octocloud.web.github-auth
(use lstoll.utils
oauthentic.ring
[noir.core :only [defpage custom-handler pre-route]]
[noir.response :only [redirect]])
(require [clj-http.client :as http]
[noir.session :as s]
diff -ur libvirt-0.9.11.4/src/esx/esx_driver.c libvirt-0.9.11.4-patched/src/esx/esx_driver.c
--- libvirt-0.9.11.4/src/esx/esx_driver.c 2012-06-15 20:21:54.000000000 +0200
+++ libvirt-0.9.11.4-patched/src/esx/esx_driver.c 2012-09-30 19:14:36.000000000 +0200
@@ -788,8 +788,8 @@
result = 0;
cleanup:
- VIR_FREE(username);
- VIR_FREE(unescapedPassword);
+ /* VIR_FREE(username); */
@lstoll
lstoll / gist:3827216
Created October 3, 2012 14:29
libvirt ESX thin provision on copy
diff -ur libvirt-0.9.11.4/src/esx/esx_storage_driver.c libvirt-0.9.11.4-patched/src/esx/esx_storage_driver.c
--- libvirt-0.9.11.4/src/esx/esx_storage_backend_vmfs.c 2012-06-15 20:23:21.000000000 +0200
+++ libvirt-0.9.11.4-patched/src/esx/esx_storage_backend_vmfs.c 2012-10-03 16:44:02.000000000 +0200
@@ -1197,6 +1197,7 @@
char *datastorePathWithoutFileName = NULL;
char *datastorePath = NULL;
esxVI_FileInfo *fileInfo = NULL;
+ esxVI_FileBackedVirtualDiskSpec *virtualDiskSpec = NULL;
esxVI_ManagedObjectReference *task = NULL;
esxVI_TaskInfoState taskInfoState;
to_parse = Queue.new
to_fetch = Queue.new
threads = []
threads << Thread.new do
while true do
if queue.size > MAX_WE_WANT_QUEUED
sleep 5
else
@lstoll
lstoll / gist:5039016
Created February 26, 2013 14:58
ruby 1.9.3 / OSX interpreter in German
BEER BEER SCHNITZEL SCHNITZEL BEER BEER BEER BEER
BEER BEER BEER BEER BEER SCHNITZEL BEER SCHNITZEL
BEER BEER BEER SCHNITZEL BEER BEER SCHNITZEL BEER
BEER BEER BEER BEER BEER BEER BEER SCHNITZEL
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL BEER BEER BEER
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL BEER
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL BEER BEER
SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL SCHNITZEL
@lstoll
lstoll / barcelona-drinkup.geojson
Last active December 22, 2015 16:09
Barcelona Drinkup
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@lstoll
lstoll / gist:7975423
Last active April 14, 2022 18:52
vmx options for OS X under VMWare
# These fields need to be in the vmx for OS X to function. You will probably need to delete the
# existing guestOS and ethernet0.virtualdev entries. You will also need to make sure the disk
# has been added as SCSI, and set as boot drive.
# You might also want to set a cron task as root in the VM to run:
# @reboot /usr/sbin/networksetup -detectnewhardware
# to make sure the VM configures networking
virtualHW.version = "9"
firmware="efi"
hg_ps1() {
hg prompt "{ on {branch}}{ at {bookmark}}{status}{ ↑{outgoing}}{outgoing|count}{ ↓{incoming}}{incoming|count}" 2> /dev/null
}
function parse_git_branch {
#[ -d .git ] || return 1
git_status="$($@ -c status.displayCommentPrefix=true status)" # 2> /dev/null)"
branch_pattern="^# On branch ([^${IFS}]*)"
remote_pattern="# Your branch is (.*) of"
diverge_pattern="# Your branch and (.*) have diverged"

Keybase proof

I hereby claim:

  • I am lstoll on github.
  • I am lstoll (https://keybase.io/lstoll) on keybase.
  • I have a public key whose fingerprint is FEE1 FA02 5493 B259 CC6A C1E8 378C F51D 274A F8E1

To claim this, I am signing this object: