Skip to content

Instantly share code, notes, and snippets.

View mindreframer's full-sized avatar
🎯
Focusing

Roman Heinrich mindreframer

🎯
Focusing
View GitHub Profile
@mindreframer
mindreframer / 0_reuse_code.js
Created December 12, 2013 16:09
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mindreframer
mindreframer / docker-clear-orphaned-volumes.py
Created December 4, 2013 13:51
volumes clearing script for docker, a copy from https://github.com/dotcloud/docker/issues/197 with some fixes
#!/usr/bin/python
import json
import os
import shutil
import subprocess
import re
dockerdir = '/var/lib/docker'
volumesdir = os.path.join(dockerdir, 'volumes')
@mindreframer
mindreframer / install.md
Last active June 1, 2022 20:05
Lunchy OSX

Lunchy: OSX launchctl wrapper

https://github.com/sosedoff/lunchy-go

# install it
wget http://dl.bintray.com/sosedoff/generic/0.1.0_darwin_amd64.zip
unzip 0.1.0_darwin_amd64.zip
mv lunchy /usr/local/bin/
@mindreframer
mindreframer / example.rb
Created December 1, 2013 17:55
generate xml with nokogiri
require 'nokogiri'
@objects = [1,2,3]
builder = Nokogiri::XML::Builder.new do |xml|
xml.root do
xml.objects do
@objects.each do |o|
xml.object do
xml.send('ng-wizard', {:model => "user", :field => "email"}, " ")
end
@mindreframer
mindreframer / gist:7340640
Created November 6, 2013 17:35
update golang to 1.2.rc3 on osx
cd /tmp
wget https://go.googlecode.com/files/go1.2rc3.darwin-amd64-osx10.8.tar.gz
tar xvfz go1.2rc3.darwin-amd64-osx10.8.tar.gz
mv /usr/local/go /usr/local/go.old
mv /tmp/go /usr/local/go
cp /usr/local/go/bin/go /usr/local/bin/go
cp /usr/local/go/bin/godoc /usr/local/bin/godoc
cp /usr/local/go/bin/gofmt /usr/local/bin/gofmt
#! /usr/bin/env bash
# Remove OpsWorks security groups from the given region
# Available regions:
# ====================
# ap-northeast-1 => Asia Pacific (Tokyo) Region
# ap-southeast-1 => Asia Pacific (Singapore) Region
# ap-southeast-2 => Asia Pacific (Sydney) Region
# eu-west-1 => EU (Ireland) Region
@mindreframer
mindreframer / example.sh
Created September 28, 2013 21:29
ruby 2.0.0 Time.iso8601 swallowing milliseconds....
[~] rvm use 2.0.0 23:22:47
Using /Users/roman/.rvm/gems/ruby-2.0.0-p247
[~] ruby -v -rtime -e 'p Time.iso8601("2013-12-11T12:09:08.123+02:00").to_f' 23:23:22
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.3.0]
1386756548.0
[~] rvm use ruby-1.9.3-p392-turbo 23:23:24
Using /Users/roman/.rvm/gems/ruby-1.9.3-p392-turbo
[~] ruby -v -rtime -e 'p Time.iso8601("2013-12-11T12:09:08.123+02:00").to_f' 23:23:29
ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.2.0]
1386756548.1230001
@mindreframer
mindreframer / snippet.rb
Created September 24, 2013 13:00
use to get a feeling about expensive requires in your application.
module Kernel
# make an alias of the original require
alias_method :original_require, :require
$require_times = {}
# rewrite require
def require name
start_time = Time.now
original_require name
time_took = Time.now - start_time