Skip to content

Instantly share code, notes, and snippets.

View robinsg's full-sized avatar

Glenn Robinson robinsg

  • 02:39 (UTC +01:00)
View GitHub Profile
@forstie
forstie / Extracting data from a string.sql
Created July 14, 2020 17:59
The SQL language is so robust, there's often more than one way to accomplish a task. In this Gist, I demonstrate how to extract the job user name from a qualified job name.
--
-- Author: Scott Forstie
-- Date : July 14, 2020
--
--
-- Question: How do I extract the Job User Name from a qualfied job name?
-- Answer : Use Locate_In_String with Substring
-- Bonus : Did you know that the QSYS2.JOB_NAME built-in global variable gives you the qualfied job-name of the current connection?
values qsys2.job_name,
@SKempin
SKempin / Git Subtree basics.md
Last active April 27, 2024 20:22
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

@halberom
halberom / output
Created August 3, 2015 11:26
ansible - example of using from_json
PLAY [localhost] **************************************************************
GATHERING FACTS ***************************************************************
ok: [localhost]
TASK: [shell cat '/tmp/file.json'] ********************************************
changed: [localhost]
TASK: [debug var=result] ******************************************************
ok: [localhost] => {
@ms5
ms5 / verbos-argpary-example.py
Last active August 24, 2023 13:37
manipulating log level with python argparse
import argparse
import logging
parser = argparse.ArgumentParser()
parser.add_argument('--verbose', '-v', action='count', default=1)
args = parser.parse_args()
args.verbose = 70 - (10*args.verbose) if args.verbose > 0 else 0
logging.basicConfig(level=args.verbose, format='%(asctime)s %(levelname)s: %(message)s',
@nfarrar
nfarrar / syslog-client.py
Created August 14, 2014 16:08
A simple command line python syslog client for generating test messages.
#!/usr/bin/env python
import argparse
import logging
import logging.handlers
parser = argparse.ArgumentParser(__file__,
description="A syslog message generator")
parser.add_argument("--address",