Skip to content

Instantly share code, notes, and snippets.

Avatar
🍩

Michael Dwan michaeldwan

🍩
View GitHub Profile
View Dockerfile
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/
View keybase.md

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:

View .bash_profile
# ---------------------------------------------------------------------------
#
# 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 Nov 25, 2013
Script to increment CFBundleVersion during the build phase
View gist:7650452
#!/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 Oct 10, 2013
Quick and dirty zlib benchmark
View benchmark.m
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 Nov 6, 2011 — forked from ryandotsmith/memstat.rb
I am using this to profile my workers (queue_classic)
View memstat.rb
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 Nov 4, 2011
Autostart Beanstalkd on MacOS
View com.beanstalkd.plist
<?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>
View generators.mongo_migration.mongo_migration_generator.rb
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 Mar 18, 2011
Simple Javascript function profiling
View profile.js
// 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 Oct 1, 2010
SASS implementation of 960 grid system
View grid.sass
$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 {