Skip to content

Instantly share code, notes, and snippets.

Jon Bartlett jonbartlett

  • Victoria, Australia
Block or report user

Report or block jonbartlett

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
@jonbartlett
jonbartlett / check_multi_byte_chars.sql
Created Oct 27, 2016
Trawl through an Oracle database for multi-byte characters
View check_multi_byte_chars.sql
set serveroutput on;
DECLARE
sql_stmt VARCHAR2(32000);
char_cols_found boolean := false;
table_name varchar2(100);
row_count number;
PROCEDURE log (msg_txt in VARCHAR2)
@jonbartlett
jonbartlett / db2-proc-export.sql
Created Oct 24, 2016
Export DB2 Stored Procedures to a file. Useful for comparing stored procs in the DB and those in source control as IDE's tend to try and format the code.
View db2-proc-export.sql
EXPORT TO proc_export.txt OF DEL
MODIFIED BY NOCHARDEL lobsinfile lobsinsepfiles
SELECT TEXT
FROM SYSCAT.ROUTINES
WHERE TRIM(ROUTINESCHEMA) ='RDS'
AND ROUTINENAME ='IU_RDS_CLASS';
@jonbartlett
jonbartlett / write_count.sh
Created Aug 26, 2016
Monitor Progress (count of records) on a DB2 ETL Process
View write_count.sh
#! /bin/sh
for i in {1..1000}
do
db2 -tf write_count.sql
sleep 30s
done
@jonbartlett
jonbartlett / ScanOCR.md
Last active May 28, 2018
Scan and OCR Solution
View ScanOCR.md

What you'll need:

Solution:

  • EPSON Connect Cloud Scan setup to scan to PDF and place file in a Dropbox folder
  • Automator script to watch "Inbox" and invoke OCR Kit with "Run Shell Script" (set "Pass Input" = "as arguments")
now=$(date +"%Y%m%d")
@jonbartlett
jonbartlett / gitprompt.sh
Last active Oct 20, 2016
Add SVN status to bash-git-prompt
View gitprompt.sh
# Add the following function to gitprompt.sh
# via http://csnipp.com/s/191/-Git-and-SVN-Status-in-the-Bash-Prompt
function prompt_callback {
local DIRTY REV=$(svn info 2>/dev/null | grep Revision | sed -e 's/Revision: //')
[ "$REV" ] || return
[ "$(svn st)" ] && DIRTY=' *'
echo "(r$REV$DIRTY)"
return
@jonbartlett
jonbartlett / crontab
Created Jul 5, 2016
call a ruby script from crontab when using rbenv
View crontab
/bin/bash -c 'export PATH="$HOME/.rbenv/bin:$PATH" ; eval "$(rbenv init -)" ; cd /home/vagrant/projects/tmux-status/ ; ruby -v
@jonbartlett
jonbartlett / db2_alter_tb_idempotent.ddl
Last active Oct 26, 2016
Create a DB2 Table in an idempotent manner
View db2_alter_tb_idempotent.ddl
--
-- db2 -td@ -vf db2_alter_tb_idempotent.ddl
--
BEGIN
IF (EXISTS (SELECT 1
FROM SYSCAT.TABLES
WHERE TRIM(TABSCHEMA)||'.'||TRIM(TABNAME) = 'TEMP.TRANSACTIONS'))
THEN
--
@jonbartlett
jonbartlett / git-author-rewrite.sh
Last active May 24, 2016
Blanket update email for commits in a repo
View git-author-rewrite.sh
#!/bin/sh
git filter-branch --env-filter '
CORRECT_EMAIL="mail@jaybe.net"
export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL"
export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL"
' --tag-name-filter cat -- --branches --tags
@jonbartlett
jonbartlett / notify
Last active May 7, 2018
Notification script
View notify
#!/bin/bash
# Send a tmux, desktop, and audio notification after the completion
# of the given command when using tmux.
#
# Requires: tmux
# Recommended: espeak, libnotify
#
# modified version of https://gist.github.com/thewtex/4969741
#
@jonbartlett
jonbartlett / .profile_colour
Last active May 24, 2016
AIX Ksh Prompt Colour by Hostname
View .profile_colour
#
# Prompt colour by host
#
# install:
#
# cat .profile_colour >> ~/.profile
#
NODE=`uname -n`
You can’t perform that action at this time.