Skip to content

Instantly share code, notes, and snippets.

View tilo's full-sized avatar
👋

Tilo tilo

👋
View GitHub Profile
@dudo
dudo / wrapper.rb
Last active June 30, 2021 04:30
Wrap a method with a macro. Allow for procs to be passed.
module Wrapper
def wrap(method_name, options: {})
proxy = Module.new
proxy.define_method(method_name) do |*args, &block|
options = instance_exec(&options) if options.is_a?(Proc)
target = is_a?(Module) ? "#{self}." : "#{self.class}#"
puts "#{target}#{method_name} is about to be called. `wrap` options #{options}"
super *args, &block
end
self.prepend proxy
@dudo
dudo / kubernetes.local.md
Last active December 5, 2021 17:00
Tooling for Interacting with Kubernetes

Kubernetes local development

kubectl

Autocomplete

@davesherratt
davesherratt / gist:3799434
Created September 28, 2012 12:07
Centos 6.3 - Nginx ruby 1.9.3 rails unicorn
yum -y update
yum -y install emacs readline-devel ncurses-devel libevent-devel glib2-devel libjpeg-devel freetype-devel bzip2 bzip2-devel bzip2-libs openssl-devel pcre pcre-devel gpg make gcc yum-utils unzip
yum grouplist |grep -i Development
rpm -ihv http://centos.alt.ru/repository/centos/6/x86_64/centalt-release-6-1.noarch.rpm
rpm -Uvh http://mirrors.ukfast.co.uk/sites/dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm
@jlecour
jlecour / init_unicorn.sh
Created June 25, 2012 13:39
Unicorn configuration
#!/bin/bash
set -e
### BEGIN INIT INFO
# Provides: unicorn
# Required-Start: $all
# Required-Stop: $network $local_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
@sinisterchipmunk
sinisterchipmunk / LICENSE
Last active September 8, 2023 17:57
tar, gzip, and untar files using ruby in memory without tempfiles
Copyright (C) 2011 by Colin MacKenzie IV
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
@makevoid
makevoid / csv.rb
Created October 20, 2011 22:08
Convert Hashes to CSV easily
# Convert Hashes to CSV easily
# source.rb
#
# { valid: "ruby", hash: "" }
# { another: "valid", ruby: "hash" }
# { etc...
# usage:
#