Skip to content

Instantly share code, notes, and snippets.

View beanieboi's full-sized avatar

Ben Fritsch beanieboi

View GitHub Profile
AllCops:
Exclude:
- config/**/*
- db/**/*
Metrics/LineLength:
Description: 'Limit lines to 120 characters.'
Max: 120
Metrics/CyclomaticComplexity:
@beanieboi
beanieboi / gist:ad526faf063181f336a2
Last active May 11, 2023 15:59
Codeship Nginx Config for Heroku
daemon off;
# Heroku dynos have at least 4 cores.
worker_processes <%= ENV['NGINX_WORKERS'] || 4 %>;
events {
use epoll;
accept_mutex on;
worker_connections 1024;
}
# For more information visit the GitHub documentation: https://github.com/krausefx/deliver
# Everything next to a # is a comment and will be ignored
# hide_transporter_output # remove the '#' in the beginning of the line, to hide the output while uploading
########################################
# App Metadata
########################################
@beanieboi
beanieboi / gist:4bf04221c20b48c0fe99
Created December 6, 2014 19:20
Download Redbull - Day of my Youth
rtmpdump --rtmp rtmp://cp250155.edgefcs.net/ondemand/ --playpath mp4:media/2635130829001/201411/3772/2635130829001_3908406916001_MI201405170001-mpeg-4-hd-high-1080p-8mbits.mp4 -o redbull.mp4
@beanieboi
beanieboi / gist:c1ce1eedec6236aceeba
Created October 18, 2014 01:07
segfault lxc-snapshot in LXC 1.0.5 on Ubuntu Trusty
lxc-snapshot --name=railsonfire -r snap0
Segmentation fault (core dumped)
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7bb8851 in lxcapi_snapshot_restore (c=0x55555575a3b0, snapname=0x7fffffffe8f9 "snap0", newname=0x0) at lxccontainer.c:3089
3089 bdev = bdev_init(c->lxc_conf->rootfs.path, c->lxc_conf->rootfs.mount, NULL);
@beanieboi
beanieboi / fetch_vs_or.md
Last active August 29, 2015 14:06
Benchmarking fetch vs [] in Ruby
Calculating -------------------------------------
hash containing key using fetch with block
                         56342 i/100ms
hash containing key using [] with ||
                         63758 i/100ms
-------------------------------------------------
hash containing key using fetch with block
                      1600812.5 (±25.4%) i/s -    6592014 in   5.013939s
hash containing key using [] with ||
@beanieboi
beanieboi / 1_proc_yield.md
Last active August 29, 2015 14:06
Benchmarking block.call vs yield
Calculating -------------------------------------
              &block     19651 i/100ms
               yield     25992 i/100ms
-------------------------------------------------
              &block   361821.1 (±31.2%) i/s -    1316617 in   5.001739s
               yield 11423477091.4 (±27.9%) i/s - 21463829712 in   3.010145s

Comparison:
 yield: 11423477091.4 i/s

The Benchmark

Calculating -------------------------------------
       map + flatten      1927 i/100ms
            flat_map      2603 i/100ms
-------------------------------------------------
       map + flatten    19876.1 (±9.2%) i/s -     100204 in   5.086854s
            flat_map 74241008.8 (±18.8%) i/s -  312185599 in   4.754152s

Comparison:
18/05/14 20:02:25,552 Tweetbot[421]: (
0 CoreFoundation 0x00007fff8ce2925c __exceptionPreprocess + 172
1 libobjc.A.dylib 0x00007fff8b75de75 objc_exception_throw + 43
2 CoreFoundation 0x00007fff8ce2910c +[NSException raise:format:] + 204
3 AppKit 0x00007fff943c8797 _NSBlockNumberForIndex + 85
4 AppKit 0x00007fff943cb3f1 -[NSLayoutManager textContainerForGlyphAtIndex:effectiveRange:] + 274
5 AppKit 0x00007fff9454d71c -[NSTextView drawsVerticallyForCharacterAtIndex:] + 198
6 AppKit 0x00007fff9454d63e -[NSTextInputContext drawsVerticallyForCharacterAtIndex:] + 41
7 AppKit 0x00007fff9454d5d6 -[NSTextInputContext remapsArrowKeysForVerticalOrientation] + 76
8 AppKit 0x00007fff9452dca9 -[NSKeyBindingManager(NSKeyBindingManager_MultiClients) interpretEventAsCo
@beanieboi
beanieboi / gist:10373044
Last active August 29, 2015 13:58
Librato Sign Ups
wrong:
divide([sum(s("prod.myapp.signups", "*"), sum(s("prod.myapp.cancels", "*")))])
fixed:
divide([sum(s("prod.myapp.signups", "*")), sum(s("prod.myapp.cancels", "*"))])