Skip to content

Instantly share code, notes, and snippets.

View carlzulauf's full-sized avatar

Carl Zulauf carlzulauf

  • Unabridged Software
  • Denver, CO
View GitHub Profile
Backbone.ajax = function(){
var old_function = Backbone.ajax
return function() {
// do some stuff before calling the old function
result = old_function.apply(arguments)
// do some stuff after calling the old function
@carlzulauf
carlzulauf / strategies.md
Created April 9, 2014 22:27
Strategies for Personal Information Security

Our personal information isn't really secure. It probably never has been, but our increasing reliance on digital services and the constant public disclosure of large breaches is only making that clearer.

You can't protect your personal information. Its already in the hands of third parties. All we can really do is take some steps to reduce the pain when our information falls into the wrong hands.

  • Never use a debit card or any other card backed by real money. Not online, not in person. Maybe even ask your bank for an old-fashioned ATM card and get rid of the debit card altogether. When someone does make fraudulent charges, you don't want to have your real money disappear while you wait for your banks fraud department to investigate and refund. With a credit card the fraudster is merely racking up temporary debt that will disappear when the investigation is complete. In the meantime you can use one of your other credit cards (you should have at least two) and your real money is never touched.
  • Use a passwo
@carlzulauf
carlzulauf / sax_issue.rb
Created April 4, 2014 23:07
Issue with overcoming errors when using nokogiri's SAX parser
require 'nokogiri'
class Doc < Nokogiri::XML::SAX::Document
include Enumerable
def initialize(xml)
@xml = xml
end
def each(&block)
@carlzulauf
carlzulauf / restart_file_present.rb
Last active January 4, 2016 08:09 — forked from technicalpickles/restart_file_touched.rb
god/conditions/restart_file_present
module God
module Conditions
class RestartFilePresent < PollCondition
attr_reader :restart_file
def initialize
super
end
def restart_file=(file)
<%
# this is a multi-line comment
# in ERB
%>
require 'csv'
head = <<-HEAD
<?xml version="1.0" encoding="UTF-8" standalone="true"?>
<data-set xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
HEAD
foot = <<-FOOT
</data-set>
FOOT
@carlzulauf
carlzulauf / steam.rb
Created December 13, 2013 17:41
Watch the SteamOS beta download URL. Alert me when its not a 404.
require 'logger'
require 'net/http'
require 'json'
require 'mail' # gem 'mail'
dir = File.dirname(__FILE__)
logger = Logger.new(File.join(dir, "log.txt"))
logger.level = Logger::INFO
#!/bin/sh
### BEGIN INIT INFO
# Provides: btsync
# Required-Start: $network $remote_fs $syslog
# Required-Stop: $network $remote_fs $syslog
# Should-Start: network-manager
# Should-Stop: network-manager
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
require "rubygems"
require "gems"
require "json"
require "retryable"
gems = []
File.open("gems", "r") do |f|
while (l = f.gets) do
gems << l.strip()
end
@carlzulauf
carlzulauf / gist:7526708
Last active December 28, 2015 16:09 — forked from Grundell/gist:7526597
#!/usr/bin/env ruby
require 'net/http'
require 'pp'
require 'benchmark'
Pleading = Struct.new(:no, :position ,:person, :party, :replik, :content, :point)
Point = Struct.new(:no, :title)
class DocumentParsing
POINT_REGEX = /^(?<no>\d+)\s+\§\s+(?<title>.+?)\s?$/