Skip to content

Instantly share code, notes, and snippets.

View michaeldwan's full-sized avatar
🍩

Michael Dwan michaeldwan

🍩
View GitHub Profile
FROM alpine
RUN apk add supervisor redis
RUN mkdir -p /var/log/supervisor /usr/local/var/db/redis/
COPY config/redis.conf /usr/local/etc/redis/redis.conf
COPY config/supervisord.conf /etc/supervisord.conf
COPY ./entrypoint.sh /usr/local/bin/

Keybase proof

I hereby claim:

  • I am michaeldwan on github.
  • I am michaeldwan (https://keybase.io/michaeldwan) on keybase.
  • I have a public key whose fingerprint is 9445 1A1E 4C2C AB40 38FA 12F9 B6CE EAA6 0F99 C686

To claim this, I am signing this object:

# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@michaeldwan
michaeldwan / gist:7650452
Created November 25, 2013 22:58
Script to increment CFBundleVersion during the build phase
#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
@michaeldwan
michaeldwan / benchmark.m
Created October 10, 2013 15:54
Quick and dirty zlib benchmark
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:entry];
NSLog(@"%@", data);
NSLog(@"Uncompressed: %d", [data length]);
double start;
start = [NSDate timeIntervalSinceReferenceDate];
for (int x = 0; x < 50000; x++) {
@michaeldwan
michaeldwan / memstat.rb
Created November 6, 2011 19:26 — forked from ryandotsmith/memstat.rb
I am using this to profile my workers (queue_classic)
module Memstat
extend self
MAC = RUBY_PLATFORM =~ /darwin/
def log
"memory=#{real_mem_size} ruby_objects=#{num_objects}"
end
def real_mem_size
@michaeldwan
michaeldwan / com.beanstalkd.plist
Created November 4, 2011 21:58
Autostart Beanstalkd on MacOS
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.beanstalkd</string>
<key>KeepAlive</key>
<true/>
<key>ProgramArguments</key>
<array>
@michaeldwan
michaeldwan / generators.mongo_migration.mongo_migration_generator.rb
Created October 14, 2011 18:30
ActiveRecord migrations but like, for mongo
class MongoMigrationGenerator < Rails::Generators::NamedBase
source_root File.expand_path('../templates', __FILE__)
def create_mongo_migration_file
version = Time.now.utc.strftime("%Y%m%d%H%M%S")
template "migration.rb", "db/mongo_migrations/#{version}_#{file_name}.rb"
end
end
@michaeldwan
michaeldwan / profile.js
Created March 18, 2011 20:51
Simple Javascript function profiling
// Pass a function to profile and optionally the number of times to run
function profile(test, times) {
var start = new Date().getTime();
if (times === undefined) {
times = 100;
}
for (i = 0; i < times; ++i) {
test();
};
@michaeldwan
michaeldwan / grid.sass
Created October 1, 2010 23:12
SASS implementation of 960 grid system
$column_width: 30;
$gutter_width: 10;
@mixin container($columns) {
margin-left: auto;
margin-right: auto;
width: #{($columns * ($column_width + $gutter_width))}px;
}
@mixin alpha-column {