Skip to content

Instantly share code, notes, and snippets.

Jonathan Barber jbarber

Block or report user

Report or block jbarber

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
jbarber / pagerduty_incidents.rb
Created Sep 24, 2019
Extract all the PagerDuty incidents for analysis
View pagerduty_incidents.rb
require 'httparty'
require 'uri'
require 'csv'
def get_incidents
limit = 100
url = "{limit}&offset="
incidents = []
offset = 0
jbarber / calendar_events.rb
Last active Sep 24, 2019
List events in google calendar
View calendar_events.rb
# gem install google-api-client
require "google/apis/calendar_v3"
require "googleauth"
require "googleauth/stores/file_token_store"
require "date"
require "fileutils"
OOB_URI = "urn:ietf:wg:oauth:2.0:oob".freeze
APPLICATION_NAME = "Google Calendar API Ruby Quickstart".freeze
View find_pii_objects.rb
def log_object(job_id, step_id, bucket, key)
puts ['found', job_id, step_id, bucket, key].join(',')
def log_missing(job_id, object_id, msg)
puts ['missing', job_id, object_id, msg].join(',')
# Finding the offending RfTests
rf_test_ids = RfTest.where(client_id: 5627)
jbarber / get_repos.rb
Last active Jul 5, 2018
Github GraphQL query for repos, their topics, and Gemfile
View get_repos.rb
require 'httparty'
require 'json'
require 'byebug'
def get_data
query ='repos.graphql', 'r').read
token = ''
cursor = nil
repos = []
org = 'evil_mega_corp'
jbarber /
Last active Mar 27, 2018
Prototypical Ruby event machine based webserver for serving context over unix domain sockets
$ echo '{"foo": "bar"}' | curl --unix-socket /tmp/ -d @-
{"message":"{\"foo\": \"bar\"}"}
$ curl --unix-socket /tmp/
jbarber / server.rb
Created Mar 27, 2018
Prototypical Ruby event machine based webserver for serving context over unix domain sockets
View server.rb
$ echo '{"foo": "bar"}' | curl --unix-socket /tmp/ -d @-
{"message":"{\"foo\": \"bar\"}"}
$ curl --unix-socket /tmp/
jbarber /
Last active Apr 24, 2017
Creating a CSR and sign it with OpenSSL
# Create a new CSR + key
# If you want a more complicated subject, '/' seperate the fields
openssl req -nodes -keyout "$HOST.key" -out "$HOST.csr" -new -subj "/CN=$HOST"
# Create a new CSR + key with SAN
echo -e "[SAN]\nsubjectAltName=DNS:$HOST,DNS:${HOST/foo/bar}\n" | \
cat /etc/ssl/openssl.cnf - | \
openssl req -nodes -keyout "$HOST.key" -out "$HOST.csr" -new -subj "/CN=$HOST" -reqexts SAN -config /dev/stdin
jbarber / chrome.js
Created Nov 26, 2016
PhantomJS 2.1.1 snippet for getting versions of $LATEST chrome installers
View chrome.js
var page = require('webpage').create();'', function(status) {
console.log("Status: " + status);
if(status === "success") {
var winVer = page.evaluate(function() {
return document.querySelector("#download span[ng-bind='win64Version']").innerHTML;
var macVer = page.evaluate(function() {
return document.querySelector("#download span[ng-bind='macVersion']").innerHTML;
jbarber / selenium.rb
Created Nov 22, 2016
Selenium ruby example
View selenium.rb
require "selenium-webdriver"
profile =
#profile['devtools.errorconsole.enabled'] = false
profile[''] = false
profile['devtools.errorconsole.enabled'] = false
%w[css csserror csslog cssparser error exception info jslog jswarn log netwarn network networkinfo netxhr secerror secwarn serviceworkers sharedworkers warn windowlessworkers].each do |m|
profile["devtools.browserconsole.filter.#{m}"] = false
View gist:1bad455bc40e3779da9d4ce53adf0150
# Sets
ℕ = set of positive integers
ℤ = set of all integers
ℂ = set of all complex numbers
ℝ = set of all real numbers
ℚ = set of all rational numbers
∅ = {}
H = { x | ℕ > 1 } == H is the set of all postive integers greater than 1 (| == 'such that')
x ∈ ℕ == x belongs to ℕ
You can’t perform that action at this time.