Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
{
"name":"articles",
"total":51,
"result":[
{
"title":"Published Articles",
"layout":"articles/index.pug",
"summary":"List of articles",
"author":false,
"subtitle":"Article Page Examples",
@jhyland87
jhyland87 / ps1.sh
Last active January 17, 2017 23:16
#!/bin/bash
# Create /etc/profile.d/prompt.sh and add the content of this gist to it.
#
# Prompt example:
# (2)[Fri May 06 10:00:30| 0:003]{4}root@ip-172-31-1-226:~(0)#
# Format is:
# (sessions on server)[date time| Last command exec time]{# of executed cmds}username@hostname:working_directory(exit code of last cmd)#
#
# Example Output (of $[prompt[0]}): http://d.pr/i/19B87
#
@jhyland87
jhyland87 / hasAny.js
Last active January 20, 2017 18:11
Lodash mixin to check if a collection (array or object) has any of the specified value(s) or key(s) (Basically its _.has(), except instead of requiring ALL paths specified exist, this checks of ANY exist)
/**
*
* @examples
* // Collection Array & multiple seeked values:
* _.hasAny(['one','two','three','four'], ['four','five']) // true
* _.hasAny(['one','two','three','four'], ['five','six']) // false
*
* // Collection Array & a single seeked value:
* _.hasAny(['one','two','three','four'], 'four') // true
* _.hasAny(['one','two','three','four'], 'five') // false
const _ = require( 'lodash' )
let aliases = [
"alias",
[
" aliases ",
[
"idk",
"TEST ",
123
const _ = require( 'lodash' )
let aliases = [
"alias",
[
" aliases ",
[
"idk",
"TEST ",
123
@jhyland87
jhyland87 / bash_input.sh
Last active September 29, 2022 00:42
Example of a function that accepts input from stdin or as arguments
function trim {
if [ $# -eq 0 ]
then
data=$(cat)
else
data="$*"
fi
data="${data#"${data%%[![:space:]]*}"}"
data="${data%"${data##*[![:space:]]}"}"
@jhyland87
jhyland87 / awklib.awk
Created January 30, 2017 19:50 — forked from edwardbadboy/awklib.awk
useful awk functions
function qsort(A, left, right, i, last) {
if (left >= right)
return
last = left
for (i = left+1; i <= right; i++)
if (A[i] < A[left])
swap(A, ++last, i)
swap(A, left, last)
qsort(A, left, last-1)
qsort(A, last+1, right)
( 10)[Wed Feb 01 09:08:58| 1:000]{128}jhyland@jhmac:~/Downloads(✓)$ sudo lsappinfo info $(ppidof chrome)
"Google Chrome Helper" ASN:0x0-0x19ee9ed:
bundleID="com.google.Chrome.helper"
bundle path="/Applications/Google Chrome.app/Contents/Versions/56.0.2924.76/Google Chrome Helper.app"
executable path="/Applications/Google Chrome.app/Contents/Versions/56.0.2924.76/Google Chrome Helper.app/Contents/MacOS/Google Chrome Helper"
pid = 92886 !signalled type="UIElement" flavor=2 Version="2924.76" fileType="APPL" creator="????" Arch=x86_64
parentASN="Google Chrome" ASN:0x0-0x1154153: (inferred)
checkin time = 2017/01/31 22:42:13 ( 10 hours, 26 minutes, 53.0673 seconds ago )
( 10)[Wed Feb 01 09:09:06| 0:000]{129}jhyland@jhmac:~/Downloads(✓)$ sudo lsappinfo list
( 10)[Wed Feb 01 09:12:09| 0:000]{135}jhyland@jhmac:~/Downloads(✓)$ sudo taskinfo $(pidof chrome)
process: "Google Chrome" [61197]
coalition (type 0) ID: 570
coalition (type 1) ID: 0
suspend count: 0
virtual bytes: 3.67 GB; resident bytes: 301.37 MB
run time: 174270 s
user/system time (current threads): 3924.258967 s / 1052.915051 s
user/system time (terminated threads): 193.628465 s / 196.851313 s
interrupt wakeups: 1961515 (1029590 / 52.49% from platform idle)
PACKAGE DESCRIPTION
A function that can be used to analyze the currently executing unction (function name, param names, values, return types, lines, etc)
Somewhat similar to PHP's reflection class - http://php.net/manual/en/book.reflection.php
COOK WORDS FOR TITLE
exscind - to cut out or off
reckon - add up; evaluate
assay - to examine or analyze
vet - analyze, test
skulk - lurk; shirk