Skip to content

Instantly share code, notes, and snippets.

@makuk66
makuk66 / transfer-network-config
Created June 14, 2011 09:25
Notes about using point-to-point links for routing IP addresses in virtual machines
Some experiments, which worked but were eventually not used.
See http://www.greenhills.co.uk/2011/06/10/lxc.html
Now, the next big milestone is to get networking working.
In the config, we told lxc-create to use br0 as the link,
and inside the container we have eth0:
root@thunder:/# brctl show br0
bridge name bridge id STP enabled interfaces
br0 8000.962e6bb72480 no vethP70LNx
@makuk66
makuk66 / dd-performance
Created June 15, 2011 15:31
dd performance
For shits and giggles: some crude IO performance tests based on dd'ing a 512M file of random content, results in MB/s:
macbook 10
mail server 17
KVM virtual 17
Older MacBookPro 23
Linux Workstation 45
Mac Mini SSD 46
m1.large HD 57
m1.large EBS 63
@makuk66
makuk66 / ubuntu11.04-apt.erb
Created July 19, 2011 16:41
Chef knife ec2 server create template for Natty, with node name prefix
# This is a knife ec2 server create template for Ubuntu 11.4.
# It is based on the 10.4 version in the 0.10.2 Chef distribution available here:
# https://github.com/opscode/chef/blob/master/chef/lib/chef/knife/bootstrap/ubuntu10.04-apt.erb
# with modifications to:
# - use the natty APT repository
# - install Chef 0.10.2
# - avoid starting the /etc/init.d/chef-client service until the client.rb has been written
# - allow a CHEF_NODE_NAME_PREFIX environment variable to prefix to the node name
bash -c '
@makuk66
makuk66 / rabbitmq-trace-logger.rb
Created August 3, 2011 13:31
simple consumer for rabbitmq firehose; see http://www.rabbitmq.com/firehose.html
#!/home/mqtester/.rvm/wrappers/ruby-1.9.2-p290@mqtester/ruby
# encoding: utf-8
require "rubygems"
require "amqp"
@exchange_name = "amq.rabbitmq.trace"
class Consumer
def handle_message(metadata, payload)
@makuk66
makuk66 / rsolr-basic-auth.rb
Created November 22, 2011 20:36
a simple Rsolr 1.0.3 example for basic auth
#!/usr/bin/env ruby
#
# A simple Rsolr 1.0.3 example for basic auth
#
# rvm gemset create rsolr-example
# rvm use rsolr-example
# gem install rsolr
require 'rsolr'
@makuk66
makuk66 / solrj.java
Created November 22, 2011 21:32
a simple solrj with basic authentication example
/*
* Simple SolrJ with basic auth example
*
* wget http://apache.mirrors.timporter.net//lucene/solr/3.4.0/apache-solr-3.4.0.tgz
* tar xvzf apache-solr-3.4.0.tgz
*
* CLASSPATH=apache-solr-3.4.0/dist/apache-solr-solrj-3.4.0.jar:apache-solr-3.4.0/dist/solrj-lib/commons-codec-1.4.jar:apache-solr-3.4.0/dist/solrj-lib/commons-httpclient-3.1.jar:apache-solr-3.4.0/dist/solrj-lib/commons-io-1.4.jar:apache-solr-3.4.0/dist/solrj-lib/jcl-over-slf4j-1.6.1.jar:apache-solr-3.4.0/dist/solrj-lib/slf4j-api-1.6.1.jar:.
*
* javac -cp $CLASSPATH solrj.java
* java -cp $CLASSPATH solrj
@makuk66
makuk66 / gist:2106616
Created March 19, 2012 10:20
jenkins apache rewrite example
<VirtualHost jenkins.mydomain.com:443>
...
RewriteEngine On
RewriteRule ^/$ /jenkins/ [R]
ProxyRequests Off
ProxyPreserveHost on
ProxyPass /jenkins/ http://localhost:8080/jenkins/
<Location /jenkins/>
ProxyPassReverse /
@makuk66
makuk66 / s3-download.py
Last active December 11, 2015 02:28
quick and dirty s3 download script using boto, which knows how to deal with EC2 IAM roles for machines.
#!/usr/bin/env python
#
# s3-download.py - a quick-and-dirty download script to download from S3
# implemented using Boto, which automatically applies AWS IAM role credentials
#
# This code is distributed under the MIT license from
# http://opensource.org/licenses/MIT:
#
# Copyright (c) 2013 Martijn Koster
#
#!/bin/bash
VM=$1
size=`sudo lvs -o lv_size --unit=b --noheadings /dev/vg_vms/ubuntu-base-vm | sed 's/^ *//'`
echo size=$size
sudo lvcreate --size=$size --name=vms-$VM vg_vms
sudo virt-resize --expand sda1 \
/dev/vg_vms/ubuntu-base-vm /dev/vg_vms/vms-$VM
mkdir -p tmp
virsh dumpxml ubuntu-base-vm > tmp/ubuntu-base-vm.xml
@makuk66
makuk66 / acng.conf.diff
Last active December 17, 2015 16:29
apt-cacher-ng patch for oracle java (.bin) and .tgz/.zip
--- acng.conf.orig 2013-05-23 21:20:04.000000000 +0100
+++ acng.conf 2013-05-28 15:02:23.000000000 +0100
@@ -100,6 +100,7 @@
#
#VfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2)$
#PfilePattern = .*(\.deb|\.rpm|\.dsc|\.tar\.gz\.gpg|\.tar\.gz|\.diff\.gz|\.diff\.bz2|\.jigdo|\.template|changelog|copyright|\.udeb|\.diff/.*\.gz|vmlinuz|initrd\.gz|(Devel)?ReleaseAnnouncement(\\?.*)?)$
+PfilePattern = .*(\.deb|\.rpm|\.dsc|\.tar\.gz\.gpg|\.tar\.gz|\.tgz|\.zip|\.diff\.gz|\.diff\.bz2|\.jigdo|\.bin(\?AuthParam=.*)?|\.template|changelog|copyright|\.udeb|\.diff/.*\.gz|vmlinuz|initrd\.gz|(Devel)?ReleaseAnnouncement(\\?.*)?)$
# Whitelist for expiration, file types not to be removed even when being
# unreferenced. Default: same as VfilePattern which is a safe bed. When and
# only when the only used mirrors are official repositories