Skip to content

Instantly share code, notes, and snippets.

View justincase's full-sized avatar

Justin Case justincase

View GitHub Profile
@justincase
justincase / net-http-debug.rb
Created September 17, 2019 18:37 — forked from ahoward/net-http-debug.rb
a simple way to debug tons of libs that use ruby's net/http
BEGIN {
require 'net/http'
Net::HTTP.module_eval do
alias_method '__initialize__', 'initialize'
def initialize(*args,&block)
__initialize__(*args, &block)
@justincase
justincase / comment
Created April 15, 2015 23:44
Fix "Failed to enable crypto" on php56
# https://github.com/composer/composer/issues/2798
# Failed to enable crypto
grafhax commented on Dec 3, 2014
I've encountered this problem when setting up new dev environments on my mac. To solve the issue i've had to make sure the php-curl library was compiled with php and updated. I generally do this using MacPorts to manage/compile the libs.
# update the ports tree (software list)
$ sudo port -v selfupdate
# install php (shortcut for compiling php with our required libs)
$ sudo port install php56
@justincase
justincase / DOCS.asciidoc
Created February 15, 2015 20:15
minimum master nodes

The minimum_master_nodes setting is extremely important to the stability of your cluster. This setting helps prevent split brains, the existence of two masters in a single cluster.

When you have a split brain, your cluster is at danger of losing data. Because the master is considered the supreme ruler of the cluster, it decides when new indices can be created, how shards are moved, and so forth. If you have two masters, data integrity becomes perilous, since you have two nodes

@justincase
justincase / list.md
Last active April 6, 2017 18:23
List of PDF Producers found in the wild

PDF Producers

  • Acrobat Distiller 9.3.2 (Windows)
  • Adobe LiveCycle Designer ES 8.2
  • Adobe PDF Library 7.0
  • Apache FOP Version 1.0
  • Crystal Reports
  • EvoPdf HTML to PDF Converter 2.2
  • FPDF 1.6
  • FPDF 1.7

Keybase proof

I hereby claim:

  • I am justincase on github.
  • I am justincase (https://keybase.io/justincase) on keybase.
  • I have a public key whose fingerprint is 1E8D B329 E2B1 1B72 427B CCE0 9A47 4C09 80A9 FECB

To claim this, I am signing this object:

@justincase
justincase / gist:6054172
Last active December 20, 2015 02:09
Spying on Spotlight with fs_usage. http://superuser.com/a/46381

To see what mds and more importantly its child mdworker is actually doing - use fs_usage to log what files it is opening:

sudo fs_usage -w -f filesys mdworker

Though there is a lot of unintelligable stuff in there, it does tell you when it opens a file to begin reading from it. Copying a PDF into my filesystem shows mdworker opening the file then immediately after lots of activity...

p.s. if you want a little less detail, this will just list the open file points:

sudo fs_usage -w -f filesys mdworker | egrep "open"
@justincase
justincase / gist:5762948
Created June 12, 2013 05:06
awesome_print: Storing output in a variable
# https://github.com/michaeldv/awesome_print/issues/89
arr = [1,2,3].ai # short for awesome_inspect
@justincase
justincase / gfm.rb
Created June 12, 2013 00:28 — forked from mojombo/gfm.rb
require 'digest/md5'
def gfm(text)
# Extract pre blocks
extractions = {}
text.gsub!(%r{<pre>.*?</pre>}m) do |match|
md5 = Digest::MD5.hexdigest(match)
extractions[md5] = match
"{gfm-extraction-#{md5}}"
end
@justincase
justincase / gist:5737137
Created June 9, 2013 00:48
Python try/else example
# http://stackoverflow.com/questions/855759/python-try-else
try:
from EasyDialogs import AskPassword
except ImportError:
getpass = default_getpass
else:
// 20 other lines
getpass = AskPassword
@justincase
justincase / gist:5492212
Created April 30, 2013 21:48
Enable mgo debug log
mgo.SetDebug(true)
var aLogger *log.Logger
aLogger = log.New(os.Stderr, "", log.LstdFlags)
mgo.SetLogger(aLogger)