Skip to content

Instantly share code, notes, and snippets.

View gtallen1187's full-sized avatar
🤪

Greg Allen gtallen1187

🤪
View GitHub Profile
@gtallen1187
gtallen1187 / createISNUMERICfunction.sql
Last active August 29, 2015 13:55
syntax for creating function in PG for isnumeric
CREATE FUNCTION isnumeric(text) RETURNS boolean AS '
SELECT $1 ~ ''^[0-9]+$''
' LANGUAGE 'sql';
@gtallen1187
gtallen1187 / charindex_postgres.sql
Last active August 29, 2015 13:55
create function charindex for postgres
CREATE OR REPLACE FUNCTION CHARINDEX(text, text, integer) RETURNS integer AS $$ SELECT CASE WHEN strpos(substr($2, $3+1), $1) = 0 THEN 0 ELSE strpos(substr($2, $3+1), $1) + $3 END; $$ LANGUAGE SQL IMMUTABLE RETURNS NULL ON NULL INPUT;
bcp [database_name.] schema.{table_name | view_name | "query" {in data_file | out data_file | queryout data_file | format nul}
[-a packet_size]
[-b batch_size]
[-c]
[-C { ACP | OEM | RAW | code_page } ]
[-d database_name]
# Add the remote, call it "upstream":
git remote add upstream https://github.com/whoever/whatever.git
# Fetch all the branches of that remote into remote-tracking branches,
# such as upstream/master:
git fetch upstream
# Make sure that you're on your master branch:
function dyn_notice() {
var percent = 0;
var notice = $.pnotify({
title: "Please Wait",
type: 'info',
icon: 'picon picon-throbber',
hide: false,
closer: false,
sticker: false,
opacity: .75,
@gtallen1187
gtallen1187 / heartbleed.py
Created April 9, 2014 03:30
python implementation of the heartbleed bug
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
jQuery("#imageID").attr('src','http://localhost:8080/images/1/myImage.png' );
@gtallen1187
gtallen1187 / refreshHtmlTextArea.py
Created August 1, 2014 07:42
short script that refreshes an HTML text area
from Spotfire.Dxp.Application.Visuals import HtmlTextArea
vis.As[HtmlTextArea]().HtmlContent += " "
@gtallen1187
gtallen1187 / navigatePages.py
Created August 1, 2014 07:42
navigate pages
Document.ActivePageReference = Document.Pages[1]
@gtallen1187
gtallen1187 / jsAddToHead.js
Created August 1, 2014 07:45
append a javascript resource file to the head
// add a scripts to head
$.getScript("https://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/jquery.dataTables.min.js", function () {
alert("your resource is ready!")
})