Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
mysql> select * from employees;
+-------------+------------+----------------+--------+------------+------------+------------------+
| employee_id | first_name | last_name | salary | join_date | department | status |
+-------------+------------+----------------+--------+------------+------------+------------------+
| 1001 | Clark | Kent | 700000 | 2017-01-05 | Banking | Employeed |
| 1002 | Peter | Parker | 800000 | 2016-11-04 | Insurance | Leave of Absence |
| 1003 | Adam | Mann | 65000 | 2017-01-12 | Banking | Employeed |
| 1004 | Sean | Cassidy | 85000 | 2017-04-06 | Insurance | Leave of Absence |
| 1005 | Jason | Blood | 65000 | 2017-03-07 | NULL | Employeed |
| 1006 | Bruce | Wayne | 82000 | 2017-03-09 | Insurance | Leave of Absence |
@jhyland87
jhyland87 / shebang2.sh
Last active May 16, 2017 19:06
A more improved version of the shebang script
#!/usr/local/bin/bash4
function stderr {
echo $@ 1>&2
[[ -z $2 ]] && exit 1
}
function abspath {
[[ -d $1 ]] && { cd "$1"; echo "$(pwd -P)"; } ||
#!/usr/local/bin/bash4
function stderr {
echo $@ 1>&2
}
function abspath {
[[ -d $1 ]] && { cd "$1"; echo "$(pwd -P)"; } ||
{ cd "$(dirname "$1")"; echo "$(pwd -P)/$(basename "$1")"; }
}
@jhyland87
jhyland87 / parse-ini.awk
Created May 15, 2017 16:33
Basic awk script that can be used to parse a config similar to the INI layout (var = val)
#! /usr/local/bin/awk -f
# Solution by Ed Morton (http://stackoverflow.com/a/43946907/5154806)
# Example: echo -e "personal.name.first=John\npersonal.name.last\t=Doe\npersonal.other.dob=\t05/07/87\npersonal.contact.phone\t=\t602123456\npersonal.contact.email\t = \tjohn.doe@idk\nemployment.jobs.1\t\t= Company One\nemployment.jobs.2 \t =Company Two\nemployment.jobs.3\t= Company Three" | ./tst.awk
BEGIN {
FS="[\t ]*=[\t ]*"
}
{
split($1,d,/\./)
data[d[1]][d[2]][d[3]] = $2
@jhyland87
jhyland87 / edu-evolution.md
Created April 17, 2017 07:52
Blog draft of how I became successful.

My story and conclusion on jobs/careers/education

I was a terribke studentenm=, I was even held back in 7th grdde, and almost 8th... 9th was a close all too. Back then, I was the kid who couted the ecoonds on the lock til the next period. I don't quite

in Highschool and Basic useful feature list:

/* Copyright (c) 2006 Tony Garnock-Jones <[email protected]>
* Copyright (c) 2006 LShift Ltd. <[email protected]>
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
@jhyland87
jhyland87 / levenshtein.js
Created March 29, 2017 19:49
Few separate ways to create a levenshtein function
var levenshtein_es5 = function(a, b) {
if(a.length == 0) return b.length;
if(b.length == 0) return a.length;
// swap to save some memory O(min(a,b)) instead of O(a)
if(a.length > b.length) {
var tmp = a;
a = b;
b = tmp;
}
@jhyland87
jhyland87 / file-bin-examples
Last active March 23, 2017 18:10
Testing the "file" commands thoroughness
$ echo -e '#!/usr/bin/awk -f\n\n# Just an awk script' | tee test-script.awk
#!/usr/bin/awk -f
# Just an awk script
$ cat test-script.awk
#!/usr/bin/awk -f
# Just an awk script
$ file --mime-type test-script.awk
test-script.awk: text/x-awk
@jhyland87
jhyland87 / atlassian-timestamp-converter.js
Created March 21, 2017 23:32
Convert the stupid "friendly" dates displayed by Atlassian to something useful
/**
* This changes the friendly timestamp display values in Atlassian from values like: Now, Today, Yesterday, n Hours Ago, etc
* Then changes the <time> tags to <span> tags (since <time> tags get updated every couple seconds)
*/
$( 'time' ).each(function( idx, elm ){
$( elm )
.text( new Date( $( elm ).attr( 'datetime' ) ).toGMTString() )
.replaceWith(function() {
return '<span>' + this.innerHTML + '</span>'
})
GREP(1) BSD General Commands Manual GREP(1)
NAME
grep, egrep, fgrep, zgrep, zegrep, zfgrep -- file pattern searcher
SYNOPSIS
grep [-abcdDEFGHhIiJLlmnOopqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [--binary-files=value] [--color[=when]]
[--colour[=when]] [--context[=num]] [--label] [--line-buffered]