Skip to content

Instantly share code, notes, and snippets.

View geertj's full-sized avatar

Geert Jansen geertj

View GitHub Profile
@geertj
geertj / BUILDERS.md
Last active November 26, 2018 20:29
EFS builders session instructions

Welcome to the EFS builders session!

We'll doing a challenge on EFS performance. To get started, we'll set up an EC2 instance and an EFS file system. Instructions:

  1. Spin up an EC2 instance from AMI ami-038ae813d2c093e7d in the US-EAST-1 region. To locate the AMI, use "Launch instance" in the AWS EC2 console. Click "My AMIs", check "Shared with me", and search for the AMI ID. You'll find the AMI under "Community AMIs". Make sure you specify a security group that has inbound SSH access.
@geertj
geertj / txlog.py
Last active May 15, 2021 03:36
Ethereum tax calculator
#!/usr/bin/env python
#
# Store Ethereum transactions to a certain address in a CSV file, with
# associated pricing data. Can be used to understand mining revenue.
import sys
import csv
import time
import json
import bisect
diff --git a/scripts/vmbuild.rb b/scripts/vmbuild.rb
index f472e74..906b4d9 100644
--- a/scripts/vmbuild.rb
+++ b/scripts/vmbuild.rb
@@ -55,9 +55,8 @@ if !cli_options[:local] && cli_options[:build_url]
$log.info("Checking out reference #{cli_options[:build_ref]} from repo #{build_repo} ...")
`git reset --hard` # Drop any local changes
`git clean -dxf` # Clean up any local untracked changes
- `git checkout #{cli_options[:build_ref]}` # Checkout existing branch
`git fetch origin` # Get origin updates
IMGFAC_SRC="/build/imagefactory"
ETC_IMGFAC_PLUGINS="/etc/imagefactory/plugins.d"
PYTHON_PATH="/usr/lib/python2.7"
if [ ! -d $IMGFAC_SRC ]
then
echo "Must Clone image factory in $IMGFAC_SRC"
exit 1
fi

Keybase proof

I hereby claim:

  • I am geertj on github.
  • I am geertj (https://keybase.io/geertj) on keybase.
  • I have a public key whose fingerprint is E260 0809 0615 3094 E635 C855 B2F5 3CB7 1019 ABAC

To claim this, I am signing this object:

@geertj
geertj / wordpress.json
Created August 19, 2015 18:39
CloudFormation template for Wordpress
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Scalable Wordpress instance",
"Parameters": {
"InstanceType": {
"Type": "String",
"Description": "Instance type",
"Default": "t2.medium",
"AllowedValues": [ "t2.medium", "t2.large" ]
diff -ur ravello-2.0.orig/ravello/common/config.py ravello-2.0/ravello/common/config.py
--- ravello-2.0.orig/ravello/common/config.py 2015-02-09 10:16:16.000000000 -0500
+++ ravello-2.0/ravello/common/config.py 2015-07-17 19:12:19.127416654 -0400
@@ -25,8 +25,8 @@
cp = ConfigParser.RawConfigParser()
WINDOWS_UTILITIES_DIR = ""
-UNIX_UTILITIES_DIR = "/opt/ravello/image_tool"
-UNIX_INSTALL_DIR = "/etc/ravello/image_tool"
+UNIX_UTILITIES_DIR = "/{}/ravello/image_tool".format(os.environ['VIRTUAL_ENV'])
@geertj
geertj / cpu_map.xml.diff
Created July 2, 2014 16:52
Patch for libvirt's cpu_map.xml to detect the correct processor when used with nested SVM
--- cpu_map.xml.orig 2014-07-02 18:50:45.284772580 +0200
+++ cpu_map.xml.new 2014-07-02 18:33:47.000000000 +0200
@@ -453,6 +453,8 @@
</model>
<!-- Intel CPU models -->
+
+<!--
<model name='Conroe'>
<model name='pentiumpro'/>
@geertj
geertj / winsocketpair.py
Last active April 12, 2021 08:13
Emulates the UNIX socketpair() system call on Windows. This function uses a trick with non-blocking sockets to prevent the need for a thread. A socketpair can be used as a full-duplex, select()able pipe on Windows.
def socketpair(family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0):
"""Emulate the Unix socketpair() function on Windows."""
# We create a connected TCP socket. Note the trick with setblocking(0)
# that prevents us from having to create a thread.
lsock = socket.socket(family, type, proto)
lsock.bind(('localhost', 0))
lsock.listen(1)
addr, port = lsock.getsockname()
csock = socket.socket(family, type, proto)
csock.setblocking(0)