Skip to content

Instantly share code, notes, and snippets.

View JohnArchieMckown's full-sized avatar
💭
Retired

John Archie McKown JohnArchieMckown

💭
Retired
  • 00:33 (UTC -06:00)
View GitHub Profile
Question from Kate Ignatius
---------------------------
Have:
Family.ID Sample.ID Relationship
14 62 sibling
14 94 father
14 63 sibling
14 59 mother
17 6004 father
17 6003 mother
@JohnArchieMckown
JohnArchieMckown / RData & env()
Created August 20, 2014 13:36
Using environments for multiple versions of data from RData
To load multiple RData files which have identical variables in them and keep all versions of the variable, put them each in a separate environment
AData <- new.env();
load("AData.RData",envir=AData);
BData <- new.env();
load("BData.RData",envir=BData);
and so on.
You can then reference individual variable by using something like:
@JohnArchieMckown
JohnArchieMckown / README.md
Created August 20, 2014 14:12
Example HLASM template code for an LE enabled UNIX command

Example HLASM code

This gist contains my SKELETON.s program. This is basically a complicated "do almost nothing" written in LE-enabled HLASM. It does show how to call the C sprintf() subroutine to create a nice output message and then write it out to STDOUT via the BPX1WRT UNIX Callable Service to write that message out.

@JohnArchieMckown
JohnArchieMckown / CityCountry
Last active August 29, 2015 14:05
Example PostgreSQL CTE
CREATE TABLE t (country text, city text, ... other fields);
--
SELECT avg(b.countcountry)::int as "CountryCount", b.country, a.city, count(a.city) as "CityCount"
FROM t AS a
INNER JOIN
(SELECT COUNT(country) AS countcountry, country FROM t GROUP BY country) AS b
ON a.country = b.country
GROUP BY b.country, a.city
ORDER BY 1 DESC,4 DESC;
--
@JohnArchieMckown
JohnArchieMckown / add_mac_vlan.sh
Last active August 29, 2015 14:05
Help generate macvlan & support programs. Two default gateways on one NIC with 2 Internet routers
#!/bin/sh
ip link add link p36p1 mac1 address 56:61:4f:7c:77:db type macvlan
# next line adds default route via the router connected to the cable modem
ip route add default via 192.168.151.65 dev mac1 table mac1tbl # refers to /etc/iproute2/rt_tables entry
ip rule add from 192.168.151.65/32 table mac1tbl
ip rule add to 192.168.151.65/32 table mac1tbl
@JohnArchieMckown
JohnArchieMckown / rust-root-files.txt
Created September 5, 2014 01:53
list of files in $HOME from rust install via "sudo make install"
112865735 4 drwxr-xr-x 2 root root 4096 Sep 4 08:20 ./tmp/empty_dir
16385680 100 -rw------- 1 root root 100515 Sep 4 08:19 ./doc/rustc/stability.html
16386425 4 drwx------ 5 root root 4096 Sep 4 08:19 ./doc/rustc/plugin
16386427 4 drwx------ 2 root root 4096 Sep 4 08:19 ./doc/rustc/plugin/build
16386429 8 -rw------- 1 root root 4459 Sep 4 08:19 ./doc/rustc/plugin/build/fn.find_plugin_registrar.html
16386428 8 -rw------- 1 root root 4392 Sep 4 08:19 ./doc/rustc/plugin/build/index.html
16386436 4 drwx------ 2 root root 4096 Sep 4 08:19 ./doc/rustc/plugin/registry
16386438 8 -rw------- 1 root root 6862 Sep 4 08:19 ./doc/rustc/plugin/registry/struct.Registry.html
16386437 8 -rw------- 1 root root 4360 Sep 4 08:19 ./doc/rustc/plugin/registry/index.html
16386430 4 drwx------ 2 root root 4096 Sep 4 08:19 ./doc/rustc/plugin/load
@JohnArchieMckown
JohnArchieMckown / DEFINES
Last active October 6, 2021 10:27
REXX program to parse a LISTCAT and create IDCAMS control cards
/* REXX PROGRAM TO GENERATE IDCAMS DEFINE */
TRACE E
DEFINED = ""
RESTARTS = 0
CARD='/* RUN AT ' TIME('N') ' ON ' DATE('S')
DO FOREVER;
EXITCODE = @MAIN()
IF EXITCODE = 0 THEN LEAVE
RESTARTS = RESTARTS+1
IF RESTARTS > 3 THEN LEAVE
@JohnArchieMckown
JohnArchieMckown / cbtdown.sh
Last active December 11, 2017 16:27
z/OS UNIX download method for CBTTape.org files.
#!/bin/sh
# Get one or more files from CBTtape.org
#
if [ $# -eq 0 ]; then #help
printf "%s\n" "This routine takes one or more file names as input." \
"These are the CBT file numbers to be downloaded." \
"This routine constructs and executes a \"curl\" command to download the file(s)." \
"Example: \"$0 290\" would run \"curl ftp://cbttape.org/ftp/cbt/CBT209.zip >CBT209.zip\"." \
"This results in the file CBT290.zip being placed in the current directory." \
"You can then \"unzip\" this using the command: jar -xvf CBT209.zip" \
@JohnArchieMckown
JohnArchieMckown / sql_good-advice.txt
Created September 18, 2014 11:38
A wonderful post by Keith Medcalf [email protected] on "thinking in SQL" from General Discussion of SQLite Database <[email protected]>
You cannot do any of these things in any relational database. You can only do this in navigational databases. There are various kludges which permit you to simulate navigational abilities on top of relational databases, but they are all kludges which are performed by various forms of fakery to impose navigability on top of a model which inherently is not navigable.
For example, many database drivers can kludge you up what is called a "keyset" driven cursor. It does this by executing the query and storing a temporary table containing the primary keys of each table in the query for each result row (this is stored either in the driver (for a client-driven keyset) or on the server (for a server driven keyset). When you ask for a row from the keyset, the primary keys are used to issue a bunch of queries to "reconstruct" the "present view" of the result that would be at that navigational location for you. There are also, usually in these same drivers, what are called "scrollable" cursors. These differ from a
@JohnArchieMckown
JohnArchieMckown / pathmunge
Created October 16, 2014 12:29
pathmunge is a shell function to add a directory to the PATH. It will add the specified directory only if: (1) it currently exists and (2) it is not already on the PATH. It can add the directory either at the beginning of the PATH (defautl) or at the end of the PATH.
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if [ -e $1 ]; then
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi