Skip to content

Instantly share code, notes, and snippets.

View RJ's full-sized avatar
💤

Richard Jones RJ

💤
View GitHub Profile
@RJ
RJ / vmware-ec2.md
Last active February 1, 2023 13:18
Exporting VMWare images (OVA) from EC2

How to provision VMWare compatible .ova images on EC2

EC2 only lets you export instances as VMWare-compatible OVA files if you originally imported that instance from an OVA. Presumably it preserves the metadata and XML gubbins for the instance, and just wraps it up again using that metadata on export.

In order to provision arbitrary VMs in an OVA-exportable way, we abuse the volume snapshots on one VM.

Prep work:

  • Make a fresh install of ubuntu server or whatever your base distro is, in VMWare, export as OVA file. (single disk only!)
  • Untar the OVA and import the VMDK file into ec2 using ec2-instance-import onto an HVM instance type (ie, no xen kernel needed)
@RJ
RJ / ec2-iam-custom-inline-policy-packer.json
Created April 9, 2015 13:49
EC2 user custom inline policy for packer ec2-builder
{
"Statement": [
{
"Sid": "PackerSecurityGroupAccess",
"Action": [
"ec2:CreateSecurityGroup",
"ec2:DeleteSecurityGroup",
"ec2:DescribeSecurityGroups",
"ec2:AuthorizeSecurityGroupIngress",
"ec2:RevokeSecurityGroupIngress"
node.default['java']['install_flavor'] = 'oracle' # ugh
node.default['java']['jdk_version'] = '7'
node.default['java']['accept_license_agreement'] = true
node.default['java']['oracle']['accept_oracle_download_terms'] = true
## Mission: install oracle's java, because cassandra prefers it.
##
## Problem: esl-erlang depends on "default-jre-headless" (openjdk)
## but that conflicts with oracle's java packages, so we can't
## just remove openjdk, as it takes esl-erlang with it.
gulp.task('flatten-js', function() {
return gulp.src(['app/*.js', './app/**/*.js'])
.pipe(flatten())
.pipe(gulp.dest('./build/js-app'))
});
function bundleEntryPoint(entryfile) {
process.env.NODE_PATH = ( process.env.NODE_PATH ?
process.env.NODE_PATH + ':' : '')
+ './build/js-app/'
@RJ
RJ / ldap-config.txt
Created May 12, 2014 15:43
Setting up LDAP server for testing our ldap auth against
as root:
apt-get install slapd ldap-utils cpu
edit, /etc/cpu/cpu.conf replace these lines:
LDAP_URI = ldap://localhost
BIND_DN = cn=admin,dc=nodomain
BIND_PASS = irccloud
USER_BASE = dc=nodomain

Keybase proof

I hereby claim:

  • I am RJ on github.
  • I am RJ (https://keybase.io/RJ) on keybase.
  • I have the public key with fingerprint 0EDD ED5C 68CB 98A2 222D  F327 1CB6 5397 9D96 56FD

To claim this, I am signing this object:

@RJ
RJ / 6pinger.py
Created November 19, 2013 18:10
Send an empty icmp6 echo packet from python, having bound to a specific source ipv6 address
#!/usr/bin/env python
import socket
import sys
## ipv6.google.com:
PING_TARGET = '2604:8300:100:200b:6667:3:0:4d1f'
source_ip = sys.argv[1]
addresses = [addr for addr in socket.getaddrinfo(source_ip, None) if socket.AF_INET6 == addr[0]]
src_address = addresses[0][-1][0]
@RJ
RJ / Makefile-erlang.mk
Last active November 2, 2019 07:29
Makefile fragment that generates makefile targets to call make with a given target on all apps/* subdirs. Useful for erlang projects using erlang.mk that have apps/{app1,app2,app3..} structure (which rebar doesn't mind). Eg: call "make app" and it will call "make -C apps/app1 app; make -C apps/app2 app; ..." for you.
APPDIRS := $(wildcard apps/*)
## Example hack to filter one out:
## APPDIRS := $(filter-out apps/fooapp, $(APPDIRS))
define PROXY_TARGET
$(1):
$(foreach appdir,$(APPDIRS),$(MAKE) -C $(appdir) $(1) ;)
endef
@RJ
RJ / haproxy.cfg
Created August 21, 2013 13:30
haproxy websockets config snippet
## GENERATED BY CHEF, DONT EDIT DIRECTLY
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
maxconn 10000
user haproxy
daemon
defaults
log global
@RJ
RJ / .slate
Created January 8, 2013 10:36
bit of my .slate config file
config defaultToCurrentScreen true
config nudgePercentOf screenSize
config resizePercentOf screenSize
# Shows app icons and background apps, spreads icons in the same place.
config windowHintsShowIcons true
config windowHintsIgnoreHiddenWindows false
config windowHintsSpread true
config windowHintsBackgroundColor 50;53;58;0.6