Skip to content

Instantly share code, notes, and snippets.

View Narnach's full-sized avatar

Wes Oldenbeuving Narnach

View GitHub Profile
@Narnach
Narnach / application.rb
Created July 16, 2014 09:57
Simple memory usage counter which diffs vs the last call. Built for rails, but can work anywhere.
# Add this to the very TOP of config/application.rb, before the first statement
require 'pp'
module OSCount
def self.count(msg, force_count: false)
return if ENV['RAILS_ENV'] == 'test'
count = ObjectSpace.count_objects
last_count = Thread.current['OSCount.last_count']
Thread.current['OSCount.last_count'] = count
show_count = last_count.nil?
show_count = true if force_count
# This is motivated/inspired by Avdi Grimm's post on Boolean Externalties
#
# http://devblog.avdi.org/2014/09/17/boolean-externalities/
#
# In his post he asks the question: if a predicate returns false, why does it do so?
# If you chain a lot of predicates, it's hard to figure out why you get the answer you get. Consider this example:
# This implements some simple chained predicate logic to determine if the object is scary.
class SimpleBoo
def scary?
@Narnach
Narnach / gist:ad9e4243f1799b273f4d
Created December 2, 2014 12:26
Rubymine 7.0.1 startup error
[ 2820] WARN - om.intellij.util.ProfilingUtil - YourKit controller initialization failed
java.lang.Exception: To profile application, you should run it with the profiler agent
at com.yourkit.api.Controller.getUsedPort(Controller.java:158)
at com.yourkit.api.Controller.<init>(Controller.java:83)
at com.intellij.util.ProfilingUtil.<clinit>(ProfilingUtil.java:57)
at com.intellij.util.CaptureMemorySnapshotAction.update(CaptureMemorySnapshotAction.java:25)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareUpdate(ActionUtil.java:113)
at com.intellij.openapi.actionSystem.impl.Utils.a(Utils.java:188)
at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:139)
at com.intellij.openapi.actionSystem.impl.Utils.expandActionGroup(Utils.java:164)
@Narnach
Narnach / gist:15b173f85fceace81112
Created January 27, 2015 15:12
Capistrano stats... WTF?
$ cap production deploy
DEBUG [26af543f] Running /usr/bin/env [ ! -d /usr/local/rbenv/versions/2.1.5 ] as user@example.org
DEBUG [26af543f] Command: [ ! -d /usr/local/rbenv/versions/2.1.5 ]
DEBUG [26af543f] Finished in 1.506 seconds with exit status 1 (failed).
Would you like to enable statistics? Here is an example message we would
send:
1|2015-01-27T16:10:07+01:00|2.1.5|x86_64-darwin14.0|3.3.5|ef0abd3f
Do you want to enable statistics? (y/N):
@Narnach
Narnach / moved.md
Last active December 7, 2017 19:19
Path of Exile Loot Filter

Loot filters have moved!

This started as a single file, but it grew to three filters. Gists are meant to share single files, so it became kind of awkward to use this. Please check out the filters' new home at https://github.com/Narnach/path_of_exile_loot_filters they are the same files, but it is now easier to pick the one that you want.

@Narnach
Narnach / get_mcc_mnc.rb
Last active August 29, 2015 14:26 — forked from choonkeat/get_mcc_mnc.rb
mcc mnc data from wikipedia
#!/usr/bin/env ruby
# Based on https://gist.github.com/choonkeat/4277277
#
# Not sure what the deal was with all that SSL stuff in there, but it was the cause content fetching did not work.
# Replaced it with plain old open-uri and it just works.
require 'net/https'
require 'open-uri'
require 'nokogiri'
require 'json'
# The regexp is re-compiled for every line in the file, which is SLOW
# If you are processing a lot of data, inline regexps are to be avoided!
class SlowWorker
def initialize(custom)
@custom = custom
end
def call(file)
File.open(file,'r') do |file|
file.each_line do |line|

Keybase proof

I hereby claim:

  • I am narnach on github.
  • I am narnach (https://keybase.io/narnach) on keybase.
  • I have a public key ASCzsSjEblHeiJSuCXrH0lTOnjjGis1I2uJsFh7ZduPzPQo

To claim this, I am signing this object:

eNrtXWtT40qS_Tz8CgURs9E3GHerqvTs7Z4NDBjcbYPB5vmFKEklLD8ko4fBbNz_vlmSH7It2TKY2313mBtDG5wqlbIyT57Meujb_zz3e8KQ-YHjud930WdxV2Cu6VmO-_B997JVKWm7__PvnW8NGrbP7HLk9Pg3_975x7cD2jMD-PCPb1V3EIWCS_vs-27QdXq9-wH1w13BjfoG86HR3S85ctQMnSE7jeVWy_edwLw3ItuuexbbFYLQjzt4VKkcHbSqV0e5t3AXG1fGok0GN_dcwfR6PToImPV916a9ABp34GOTX9xkPRAqJH_ihIe0Tx9YIelDr1irzQFjViHJA98p3NGDNnVNVlwNrdGANUMaBoUuKfeK9rnhOYHnFhKtPrhOWFC3zKSjQpJ1sKkj2waZYk-2H4LVGVHIionXHLtYj-vUpYUEj1zmP4yabYf1iml43-97kV-s7SHlEFBI9oIFThAW1vEhswFSxlr79mUCHN9iNBF6bMh633cldVcwezQITmPnvaDuA3dbGpjMtQ5mXxwyarERtD502BMHAzCOeuPsorUr9KnjNj2zy8Jj34sGsa8LBnUtJ6wz33R6LAi-7_70qROO3Mk3p57fp3D_M9qd_OnAj3iPTj03Gb9vsRckWBd_FHrU4BJl7-mrUDWZ0Gx7ofBpiP_g4EmNXkoJQc8Lv-9eMzoAHaGkk_sx7MVNcbTjDf_j2zHrT3SBxVQ7IfRmN4Y0QAMTnnZ8v13hMaI9eBRoQkzGongj4_4c9VifuSHtCWPwmrUpb9pks-c9MV9o-F6HWwQo-y2t7VsWs4QDDwzk7V2Lm2kwl4U-5bb6lraqrukzGvDOAeQ6JuiuCbDQnXvc9QMyto5ZuzUwTlBfPeqFzqDHXqvHpXaPobfhezTcaI-C-PFnDQqAkNTsLo_Y5uqo0ID3Omkwo6PfvsTus-yTJ6zXZ-FX4RI6BBfkOWQitgV3PGE-BevybA4EqX6qmxrWCQ19CJwbKG3JA6N-H5yaA8SxB579JoS4

As of May 2018, this is the gear in my recording setup. I built this system in late 2014 and it was relatively state of the art back then. Over the years a few things have been added (VR headset, extra screen) but the core is relatively good even for today's games. That said, I will probably replace this somewhere during 2018 with the next generation of hardware. Stay tuned :-D

  • CPU: Intel i7 4790K @ 4.0 Ghz
  • CPU cooler: Corsair Hydro H80i (closed loop water cooler)
  • GPU: 2x ATI Strix GTX 980 graphics cards
  • Mainboard: Asus Maximus VII Hero Z97
  • Memory: 16GB Kingston HyperX Beast DDR3
  • Storage: 2x Kingston HyperX 3K SSD 2.5" 240GB + 1x Western Digital Blue WD10EZEX 1TB
  • PSU: Toughpower Grand 1050W ATX2
  • Case: Aerocool XPredator X3 Evil Black edition ATX