Skip to content

Instantly share code, notes, and snippets.

View jmazzi's full-sized avatar

Justin Mazzi jmazzi

View GitHub Profile
@jmazzi
jmazzi / lastpass_to_keepassx.go
Last active December 20, 2015 10:49
Convert a LastPass CSV export to keepassx using Go lang.
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strings"
"html"
)
require 'rubygems'
require 'mechanize'
FIRST_NAME = 'FIRST_NAME'
LAST_NAME = 'LAST_NAME'
PHONE = 'PHONE'
EMAIL = 'EMAIL@provider.com'
PARTY_SIZE = 2
SCHEDULE_RANGE = { :start_time => '19:00', :end_time => '20:30' }
0.4 ➤ make
cd src/ && make -f Makefile
clang++ -c -Xclang -include-pch -Xclang ../build/KeePassX.pch/c++ -pipe -O2 -arch x86_64 -Wall -W -DQT_NO_DEBUG -DQT_XML_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/local/Cellar/qt/4.8.4/mkspecs/unsupported/macx-clang -I. -I/usr/local/Cellar/qt/4.8.4/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/lib/QtCore.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/lib/QtGui.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/lib/QtXml.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/lib/QtXml.framework/Versions/4/Headers -I/usr/local/Cellar/qt/4.8.4/include -I. -Ilib -Icrypto -Iplugins/interfaces -Iexport -Iimport -Idialogs -I../build/ui -I../build/moc -F/usr/local/Ce
@jmazzi
jmazzi / Grants.pm
Created July 10, 2013 18:02
/usr/local/cpanel/Cpanel/MysqlUtils/Grants.pm
package Cpanel::MysqlUtils::Grants;
# cpanel - Cpanel/MysqlUtils/Grants.pm Copyright(c) 2010 cPanel, Inc.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
use strict;
use warnings;
DOWN_ERRORS = [
Errno::ECONNRESET,
Errno::EHOSTUNREACH,
Errno::EINVAL,
Errno::ECONNREFUSED,
Errno::ENETUNREACH,
Net::HTTPBadResponse,
Net::HTTPHeaderSyntaxError,
Net::ProtocolError,
SocketError,
require 'securerandom'
class Vhost
attr_reader :content, :vhost_line
def initialize(vhost_line, content)
@vhost_line = vhost_line
@content = content
end
#!/usr/bin/env ruby
#--
# set.rb - defines the Set class
#++
# Copyright (c) 2002-2008 Akinori MUSHA <knu@iDaemons.org>
#
# Documentation by Akinori MUSHA and Gavin Sinclair.
#
# All rights reserved. You can redistribute and/or modify it under the same
# terms as Ruby.
@jmazzi
jmazzi / nope_spec.rb
Created June 4, 2013 18:06
With a simple rails project `rails g testing -d mysql`, rspec exits with 0 when ActiveRecord encounters method_missing.
# nope.rb
class Nope < ActiveRecord::Base
end
# nope_spec.rb
require 'spec_helper'
describe Nope do
Nope.blah
@jmazzi
jmazzi / procs.rb
Last active December 17, 2015 20:09
require 'benchmark'
def resolve(obj)
obj.respond_to?(:call) ? resolve(obj.call) : obj
end
def resolve2(obj)
if obj.respond_to?(:call)
resolve2(obj.call)
else
class Object
def tap_async(&block)
Thread.new { tap(&block) }
self
end
end