Skip to content

Instantly share code, notes, and snippets.

@davidoram
davidoram / server.go
Created Mar 3, 2022
Go server with ngrok
View server.go
package main
//
// Run the server
// go run server.go
//
// Expose via ngrok
// ngrok http 8080
//
//
View github_check_branch.sh
#/bin/bash
#
# Assumes you have run 'github_get_all.sh' to get the latest git repos for your org
#
# Note:This script will ONLY work reliably if you have run 'github_get_all.sh on an empty
# directory, so that all repos are freashly cloned and clean
#
# Iterate over all the github repos under the cwd, for each reports if
# branch1 is behind branch2
#
@davidoram
davidoram / github_get_all.sh
Last active Nov 11, 2018
Clone all github repositories for en organisation (git clone or git fetch --all)
View github_get_all.sh
#/bin/bash
#
# Checkout all repos, or brings branches up to date for an Org
#
read -d '' helptxt <<- "HELP_MSG"
Checkout all repos for a github organisation \\n
\\n
Usage:\\n
\\n
@davidoram
davidoram / schemaspy.sh
Last active May 31, 2018
Run dockerised schemaspy against a postgres database
View schemaspy.sh
#!/bin/bash
#
# - Run dockerised schemaspy against a postgres db
# - write the output to a host directory
# - Opens the generated website in your broswer
#
# Assumes you have already got the schemaspy docker image eg: `docker pull schemaspy/schemaspy:snapshot`
#
set -e
@davidoram
davidoram / unix-socket-to-tcp.sh
Created May 22, 2018
Create a UNIX socket connected to a TCP socket. Useful for connecting a rails app to a postgres instance that has been dockerized
View unix-socket-to-tcp.sh
#!/bin/bash
set -e
if [ $# -ne 3 ]; then
echo "Usage:"
echo ""
echo " `basename $0` <unix socket file> <host> <listen port>"
echo ""
echo "For example:"
View gist:ad5771f568b2e51db95828713f765765
VAGRANT_LOG=info vagrant init ubuntu/trusty64
INFO global: Vagrant version: 1.8.5
INFO global: Ruby version: 2.2.3
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_LOG="info"
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/gems/vagrant-1.8.5/bin/vagrant"
INFO global: VAGRANT_OLD_ENV_VAGRANT_LOG="info"
INFO global: VAGRANT_OLD_ENV_TERM="xterm-256color"
INFO global: VAGRANT_OLD_ENV_SSH_AUTH_SOCK="/private/tmp/com.apple.launchd.Kfz21yAIM0/Listeners"
INFO global: VAGRANT_OLD_ENV_LOGNAME="davidoram"
@davidoram
davidoram / gist:4eff788c3037d0ca358d
Created Mar 6, 2016
Snippet to find Sidekiq workers in the Retry queue, of a given worker type
View gist:4eff788c3037d0ca358d
query = Sidekiq::RetrySet.new
callbacks = query.select {|j| j.klass == 'CallbackNotificationWorker' }
@davidoram
davidoram / gist:4c9b1d2648e3e3ed5182
Created Jan 27, 2016
Print FB callstck in a method - drop this code in a method
View gist:4c9b1d2648e3e3ed5182
puts " -- > called blah_blah_method"
puts caller.select{ |f| f =~ /flybuys/ }
@davidoram
davidoram / ctags-rails.sh
Last active Mar 2, 2020
Shell script to build ctags for rails project, with details on how to configure your Atom editor to use
View ctags-rails.sh
#!/bin/bash
#
# Generate the ctags for a rails/ruby project in the following files:
#
# .tags contains the tags for the project itself
# .tags_bundler contains the tags for all libraries
#
# The idea is your editor can rebuild the .tags file on file save
# which should be quite quick
#
@davidoram
davidoram / test_specs.sh
Last active Sep 10, 2015
Given a list of specs, run one test together with each in the list
View test_specs.sh
#!/bin/bash
#
# Run a failing spec in combination with each other spec and record which combinations cause a failure
#
# Put a list of all specs into specs.txt
# eg: $ $ find spec -name '*_spec.rb' -print > specs.txt
# Set the failingspec variable below
# Set the seed variable below
#
# Writes a log to testspec.log, which is formatted as follows: