Skip to content

Instantly share code, notes, and snippets.

View l1x's full-sized avatar
🏠
Working from home

Istvan l1x

🏠
Working from home
View GitHub Profile
use std::collections::HashMap;
use std::io;
use std::num::ParseFloatError;
use std::rc::Rc;
//
// Types
//
#[derive(Clone)]
@l1x
l1x / rds_vpc_pg_multi-zone_launch.yml
Created January 29, 2016 12:47 — forked from kennwhite/rds_vpc_pg_multi-zone_launch.yml
Ansible Playbook: Create multi-zone Postgres on RDS in a VPC
# Ansible RDS Multi-AZ Postgres
#
# Assumes existing Security Group, VPC, and RDS Subnet Groups.
#
# To install Ansible on OSX:
# sudo easy_install pip
# sudo pip install paramiko PyYAML jinja2 (might be prompted to install XCode & re-run)
# sudo pip install ansible
# sudo pip install boto
# sudo mkdir /etc/ansible
@l1x
l1x / vm-resize-hard-disk.md
Created November 17, 2015 15:16 — forked from christopher-hopper/vm-resize-hard-disk.md
Resize a Hard Disk for a Virtual Machine provisioned using Vagrant from a Linux base box to run using VirutalBox.

Resize a Hard Disk for a Virtual Machine

Our Virtual Machines are provisioned using Vagrant from a Linux base box to run using VirutalBox. If the Hard Disk space runs out and you cannot remove files to free-up space, you can resize the Hard Disk using some VirtualBox and Linux commands.

Some assumptions

The following steps assume you've got a set-up like mine, where:

(go
(let [chans
(sequence
brushes
(comp
(map
(fn [[name brush]]
(if (:texture brush)
(load-texture (:texture brush)))))
(filter identity)))
  1. General Background and Overview
(ns mmu
(:gen-class)
(:use [clojure.contrib duck-streams]))
(defn gc []
(dotimes [_ 4] (System/gc)))
(defn used-memory []
(let [runtime (Runtime/getRuntime)]
(gc)
@l1x
l1x / gist:4112852
Created November 19, 2012 18:54 — forked from stympy/gist:154552
Script for running an ec2 instance based off a custom AMI, attaching an EBS volume, then associating an EIP
#!/usr/bin/env ruby
require 'rubygems'
require 'right_aws'
require 'net/ssh'
require 'open-uri'
# Git rid of ssl verification warning
class Net::HTTP
alias_method :old_initialize, :initialize
@l1x
l1x / em-http-vcr.rb
Created February 21, 2012 06:48 — forked from igrigorik/em-http-vcr.rb
Mocking with WebMock and VCR
require 'rubygems'
require 'test/unit'
require 'em-http'
require 'vcr'
VCR.config do |c|
c.cassette_library_dir = 'fixtures/vcr_cassettes'
c.http_stubbing_library = :webmock
end
// Match all nodes with FQDN ending in example.com
function(doc) {
if(doc.attributes.fqdn) {
var prefix = doc.attributes.fqdn.match(/^.*example.com$/);
if(prefix) {
emit(prefix, null);
}
}
}