Skip to content

Instantly share code, notes, and snippets.

View beanieboi's full-sized avatar

Ben Fritsch beanieboi

View GitHub Profile
@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", "*"))])
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

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:
@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
@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 / 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 / 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
# 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
########################################
def house_id
@house_id
end
def house_id=house_id
@house_id = house_id
end
def room_number
if !self.room.nil?
# traceroute6 chaosbay.hq.c3d2.de
traceroute6: Warning: chaosbay.hq.c3d2.de has multiple addresses; using 2001:6f8:1194:c3d2:a800:5bff:fe08:f05b
traceroute6 to chaosbay.hq.c3d2.de (2001:6f8:1194:c3d2:a800:5bff:fe08:f05b) from 2002:8d1e:cc52::21e:c2ff:fea4:da2f, 64 hops max, 12 byte packets
1 2002:8d1e:cc52::224:36ff:fea0:cb6b 1.715 ms 0.749 ms 0.680 ms
2 * * *
3 2001:638:c:c049::2 10.652 ms 10.853 ms 10.198 ms
4 zr-fra1-te0-7-0-4.x-win.dfn.de 14.843 ms 15.287 ms 14.243 ms
5 fe0-1-2-0.br1.ixfra.de.easynet.net 24.755 ms 25.033 ms 24.612 ms
6 2001:6f8:1::87:86:77:246 24.473 ms 24.270 ms 24.141 ms
7 2001:6f8:1::87:86:71:229 87.788 ms 302.628 ms 229.181 ms