Skip to content

Instantly share code, notes, and snippets.

@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"
@lstoll
lstoll / barcelona-drinkup.geojson
Last active December 22, 2015 16:09
Barcelona Drinkup
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
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: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;
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 / 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]
@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 / gist:3039506
Created July 3, 2012 12:39
Wrapped Java API
;; Creates the wrapped object.
(def domain (JavaWrapper. (.domainLookupByID (conn "test:///default") 1))
;; Implements ILookup, so you can call getters by invoking a keyword
(:name domain) = (.getName domain)
;; Implements Associative, so you can invoke setters via assoc
(assoc domain autostart true) = (.setAutostart domain true)
;; Original Java object accessible via :o key
;; Totally untested, but should give an idea.
(ns mn
(:use lstoll.utils) ; https://github.com/lstoll/clj-utils
(:require [clj-http.client :as http])) ; https://github.com/dakrone/clj-http
(def test-concurrency 10)
(defn test-url
"Tests a URL, returning it's status code"