Skip to content

Instantly share code, notes, and snippets.

View bidulock's full-sized avatar

Darryl Bidulock bidulock

  • Tempus AI
  • Calgary, AB
View GitHub Profile
@bidulock
bidulock / login.user.js
Created May 3, 2012 16:48
sofi dev userscripts
// ==UserScript==
// @include http://localhost:3000/users/login
// ==/UserScript==
setTimeout(function () {
document.getElementsByName("email")[0].value = "dev.null@sofi.local";
document.getElementsByName("password")[0].value = "abc..123";
document.getElementsByName("submit")[0].click();
}, 2000);
@bidulock
bidulock / ColourPatternLayout.java
Last active October 10, 2015 12:38
Colourify the level of a log4j message by overriding the PatternLayout
import java.util.HashMap;
import java.util.Map;
import org.apache.log4j.Level;
import org.apache.log4j.PatternLayout;
import org.apache.log4j.helpers.PatternConverter;
import org.apache.log4j.helpers.PatternParser;
import org.apache.log4j.spi.LoggingEvent;
public class ColourPatternLayout extends PatternLayout {
@bidulock
bidulock / gist:3899673
Created October 16, 2012 14:39 — forked from dx7/gist:1333785
Installing ruby-debug with ruby-1.9.3-p0
### UPDATE: ruby-debuy19 is no longer maintained, use https://github.com/cldwalker/debugger
# Install with:
# bash < <(curl -L https://raw.github.com/gist/3899673)
#
# Reference: http://blog.wyeworks.com/2011/11/1/ruby-1-9-3-and-ruby-debug
echo "Installing ruby-debug with ruby-1.9.3-p0 ..."
curl -OL http://rubyforge.org/frs/download.php/75414/linecache19-0.5.13.gem
@bidulock
bidulock / .psqlrc
Last active December 11, 2015 02:29
my .psqlrc file
-- Include the hostname in the prompt, and add a * when in a transaction
-- The default PROMPT2 doesn't make it obvious enough nothing has been sent to the server yet
\set PROMPT1 '%M:%/%R%x%# '
\set PROMPT2 '> '
-- Always be in a transaction. It's safer this way
\set AUTOCOMMIT off
-- Turn the pager on always. This is best used with "export PAGER=less -S -F -X" added to your .bashrc
\pset pager always
@bidulock
bidulock / zendesk-chat-notifications.user.js
Last active December 20, 2017 13:10
A basic user script to enable html5 notifications on zendesk sites when there are incoming chat requests
// ==UserScript==
// @name Desktop Notifications for zendesk
// @include https://*.zendesk.com/agent/*
// ==/UserScript==
setTimeout(function () {
var initNotifications = window.webkitNotifications ? function () {
var notify = window.webkitNotifications;
var n = null;
@bidulock
bidulock / bash_prompt.sh
Last active January 20, 2016 22:40
My $PS1. 4 lines. Horizontal rule, datetime, pwd, username@host
# This was taken and adapted from some reddit thread with a bunch of prompts.
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
PS1="\n\$(s=\$(printf '%*s' \$COLUMNS); echo \${s// /―})\n\D{%Y-%m-%d} \t\n"
PS1="$PS1\w\$(__git_ps1)\n"
PS1="$PS1${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]\$ ";
@bidulock
bidulock / tc-slow.sh
Last active January 8, 2024 16:41
Slow down traffic on localhost through a single port
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "You must run this as root."
exit 1
fi
I=lo
PORT=${PORT-23000}
DELAY=${DELAY-25ms}
@bidulock
bidulock / ansi_colours.js
Last active August 29, 2015 14:10
Add shell colour codes to a web page - bookmarklet
javascript:(function () {
var l = ['#000', '#A00', '#0A0', '#A50', '#00A', '#A0A', '#0AA', '#AAA'];
document.body.innerHTML = document.body.innerHTML.replace(/\u001b\[([0-9;]*)m/g, function (m, k) {
return k - 30 < 8 ? "<span style='color: " + l[k - 30] + "'>" : k == 39 ? "</span>" : "<span>";
});
document.body.style.backgroundColor = "#000";
document.body.style.color = "#AAA";
}());
@bidulock
bidulock / reprocess-progress.js
Last active August 29, 2015 14:14
Upload progress
javascript:(function () {
var $ = jQuery;
var styles = [
"position: fixed;",
"top: 0; right: 0; z-index: 1000;",
"width: 200px; height: 30px; line-height: 30px;",
"font-size: 14px; text-align: center;",
"background: rgba(0,0,0,0.3);"
];
var el = $("<div style='" + styles.join(' ') + "'></div>");
@bidulock
bidulock / ssh_proxy_through_config
Last active August 29, 2015 14:25
ssh through another host
# Taken from this blog post
# http://chrigl.de/blogentries/ssh-jump-host-without-nc-netcat
# Add the following to ~/.ssh/config, and adapt for your usage
#
# ProxyCommand ssh -A proxy_through_host -W %h:22
# -A -- ssh-agent forwarding [optional]
# (can be added to proxy host definition)
# proxy_through_host -- hostname of server to proxy through [required]
# -W %h:22 -- forward standard io to %h:22 (port 22) [required]
# %h is replaced with the host you're actually