Skip to content

Instantly share code, notes, and snippets.

View jqr's full-sized avatar

Elijah Miller jqr

View GitHub Profile
@jqr
jqr / weird.rb
Created January 6, 2016 02:00
Ruby scope issue with if statements
if false
x = 1
else
puts x.inspect # echos "nil", does not raise exception
end
@jqr
jqr / mongoelcapitan.diff
Created October 4, 2015 15:28
Patch for scons to compile mongodb on El Capitan
diff --git a/SConstruct b/SConstruct
index 5965b53..50a76ef 100644
--- a/SConstruct
+++ b/SConstruct
@@ -320,7 +320,7 @@ add_option('propagate-shell-environment',
0, False)
if darwin:
- osx_version_choices = ['10.6', '10.7', '10.8', '10.9']
+ osx_version_choices = ['10.6', '10.7', '10.8', '10.9', '10.10', '10.11']
@jqr
jqr / DocRaptor.cs
Last active April 8, 2018 02:15 — forked from janxious/DocRaptor.cs
DocRaptor Examples Set 1 - Non-Ruby
using System;
using System.IO;
using System.Text;
using System.Net;
using System.Web;
namespace DocRaptorConsoleExample {
class DocRaptor {
private const string PostFormat = "doc[{0}]={1}&doc[name]={2}&doc[document_type]={3}&doc[test]={4}";
private const string ApiKey = @"YOUR API KEY HERE";
@jqr
jqr / Gemfile
Last active April 8, 2018 02:15
source "https://rubygems.org"
gem "doc_raptor"
@jqr
jqr / ssl_certificate_request.rb
Last active April 8, 2018 02:15
Easily generate wildcard SSQL certificate requests
#!/usr/bin/env ruby
company_name = "__YOUR_COMPANY_NAME__"
state = "__YOUR_STATE__"
if ARGV.size == 0
puts "Usage: #{$0} <domain>"
puts "Generates a new private key and a certificate signing request."
puts
puts "NOTE: Always produces a wildcard certificate request."
puts
@jqr
jqr / ssl_certificate_fingerprint.sh
Created May 30, 2015 16:40
Easy command line SSL certificate fingerprinting
#!#!/bin/bash
if [ $1 ]; then
echo -e "GET / HTTP\1.1\n" | openssl s_client -connect $1:443 2> /dev/null | openssl x509 -noout -fingerprint | cut -f2 -d'=' | head -n 1 2> /dev/null
else
echo "Usage: $0 <host>"
echo "Generates an SSL fingerprint for a host. Useful in comparing certificate changes."
echo
echo "Examples:"
echo " $0 google.com"
echo " $0 amazon.com"
# This example will create a sample asynchronous pdf document with the authentication information as part of the POST data
curl http://docraptor.com/docs \
--fail --silent --show-error \
--header "Content-Type: application/json" \
--data '{
"user_credentials": "YOUR_API_KEY_HERE",
"doc": {
"name": "async_example.pdf",
"document_type":"pdf",
"async":"true",
def dump_redis(redis, keys)
values = {}
keys.each do |key|
case type = redis.type(key)
when "hash"
values[key] = redis.hgetall(key)
when "set"
values[key] = Set.new(redis.smembers(key))
when "list"
values[key] = redis.lrange(key, 0, -1)
require "thread"
# This is an example of how to use popen in a nonblocking fashion while
# consuming the output and manipulating it slightly. Additionally it ensures
# that the output maintains some consistency even with interleaving writes.
# Make a mutex so that we only let one thing write to stdout at a time
@stdout_mutex = Mutex.new
# A version of puts which shows some debug information, handy for showing off
@jqr
jqr / README.md
Created February 28, 2014 21:51 — forked from mbostock/.block