Skip to content

Instantly share code, notes, and snippets.

View jhyland87's full-sized avatar

J jhyland87

View GitHub Profile
@jhyland87
jhyland87 / jenkins.js
Created June 1, 2016 18:03
Custom jQuery code to introduce new functionality to the Jenkins UI
/**
* Jenkins Custom JavaScript/jQuery Code
* Author: Justin Hyland
* Created: 06/01/16
* This file is loaded by Jenkins via the Simple Theme Plugin (https://wiki.jenkins-ci.org/display/JENKINS/Simple+Theme+Plugin)
* in combination with the jQuery Plugin (https://wiki.jenkins-ci.org/display/JENKINS/jQuery+Plugin), and is used to introduce any
* customized functionality for the UI, such as setting parameter values based on other parameter values or the job name, etc.
*
* Logic: The controller.init gets executed on document.ready, and attempts to deduce the viewers username (via the profile link
* in the upper right), and details about the job (via the URL). Since all jobs are separated into the appropriate folder named
@jhyland87
jhyland87 / ip-thingy.sh
Last active June 7, 2016 18:04
Getting the local IP, and mod the 2nd octet
#!/bin/bash
# From: http://unix.stackexchange.com/a/287364/157820
nmcli con show eno16777984 | awk -F"/|[[:space:]]+" '
/^ipv4.address/ {
if ($2 ~ /^10\.10/) {
sub(/10\.10/,"10.20",$2);
} else if ($2 ~ /^10\.20/) {
sub(/10\.20/,"10.10",$2);
# Construct query with first column as STOREID, and rest of the columns are inside an WHERE IN list
awk 'BEGIN{FS=",";OFS=",";}{gsub(/[[:blank:]]+/,","); storeid=$1; $1=""; print "UPDATE STOREITEM SET replenish_status = \"N\" WHERE COMPANYID = 1795 AND STOREID = "storeid" AND ITEMID IN ("substr($0, 2)");"}' file.csv
# Example Output Queries
# UPDATE STOREITEM SET replenish_status = 'N' WHERE COMPANYID = 1795 AND STOREID = 1749 AND ITEMID IN (118469,117677,118233,.....);
import fileinput
import sys
reload(sys)
sys.setdefaultencoding("utf-8")
name = raw_input("Enter your name: ") # Python 2.x
#ascii = name.decode('unicode_escape').encode('ascii','ignore')
#utf8 = name.decode('unicode_escape').encode('utf8','ignore')
<?php
$sql = <<<EOF
SET @ship_id = (SELECT ship_id FROM orders WHERE ship_id IS NOT NULL ORDER BY ship_id LIMIT 1);
SELECT
id,
user_id,
COALESCE(ship_id, @ship_id) AS ship_id
FROM
orders;
EOF;
<?php
$set_var = <<<EOF
SET @ship_id = (SELECT ship_id FROM orders WHERE ship_id IS NOT NULL ORDER BY ship_id LIMIT 1);
EOF;
$use_var = <<<EOF
SELECT
id,
user_id,
COALESCE(ship_id, @ship_id) AS ship_id
data = [
{
"reason":{
"inventory_event_reason":"10",
"reason_input_36":"see david's email",
"reason_input_33":"",
"reason_input_34":"Credit",
"reason_input_30":"Wayne\u2019s Candies",
"reason_input_31":"",
"reason_input_35":"",
import fileinput
import sys
import string
reload(sys)
sys.setdefaultencoding("utf-8")
def sanitizeData( data ):
# This might be useful for later
#if not isinstance( dirty_string, unicode):
# return data
@jhyland87
jhyland87 / gist:5f7ed9d91875280e4f973a033dcf8db0
Created August 3, 2016 22:48
Unicode table - List of most common Unicode characters *
Unicode table - List of most common Unicode characters *
* This summary list contains about 2000 characters for most common ocidental/latin languages and most printable symbols but not chinese, japanese, arab, archaic and some unprintable.
Contains character codes in HEX (hexadecimal), decimal number, name/description and corresponding printable symbol.
What is Unicode?
Unicode is a standard created to define letters of all languages ​​and characters such as punctuation and technical symbols. Today, UNICODE (UTF-8) is the most used character set encoding (used by almost 70% of websites, in 2013). The second most used character set is ISO-8859-1 (about 20% of websites), but this old encoding format is being replaced by Unicode.
How to identify the Unicode number for a character?
Type or paste a character:
@jhyland87
jhyland87 / datatables.keepconditions.txt
Last active August 10, 2016 17:09
Example of how the DataTables Keep Conditions plugin stores conditions in the URL
// Assume the table ID example has the following details in its current state
Select Row IDs
1, 3, 5, 6, 7, 8, 10, 11, 12, 14, 16, 21, 23, 24, 25, 30, 31, 32, 34, 36, 42, 44, 45, 46, 102, 103, 104, 107, 200, 202, 203, 204
Table Filter
Hello World
Column Sorting
Col ID 1 (desc)
Column Order
4, 1, 2, 3, 5, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15, 17, 16
Pagination Page