This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Data::Dumper; | |
sub AUTOLOAD { | |
my ($self) = @_; | |
our $AUTOLOAD; # so "use strict" is happy | |
# Get the last part of what was called | |
# (i.e., This::That::my_var, $1 set to "my_var") | |
print("AUTOLOAD: AUTOLOAD=$AUTOLOAD\n"); | |
print("AUTOLOAD: \@_='" . Dumper(\@_) . "\n"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# adapted from http://hints.macworld.com/article.php?story=20110617204111325 | |
set -e | |
label="chat.rocket" | |
plistfile="$HOME/Library/LaunchAgents/$label.plist" | |
function setup_rocketchat() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import re | |
ingredient = "Kumquat: 2 cups" | |
# Name groups with ?P<name_of_group> syntax | |
pattern_text = r'(?P<ingredient>\w+):\s+(?P<amount>\d+)\s+(?P<unit>\w+)' | |
# compile for performance if using repeatedly |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Wrapper script for running python applications in a virtualenv | |
# Defaults to the awx user ansible venv used by tower | |
# To override, set the full path to the virtual env up to the bin dir | |
# | |
# usage: venv_wrapper.sh pythonscript.py scriptarg1 scriptarg2 ... | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# How it works | |
# Starts zsh with an interactive (-i) login (-l) shell with XTRACE enabled (-x) and running | |
# a noop command (:) that returns an exit value of 0. | |
# | |
# Stderr is set to stdout so that the XTRACE output can be grepped for the given alias which | |
# have the form | |
# | |
# +/path/to/file:LN> alias 'youralias=your command' | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
env="test" | |
increment="count" | |
lastversion="" | |
debug="0" | |
function echo_out() { | |
local msg="$1" | |
if [[ "$debug" == "1" ]]; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Usage: | |
# $ source itdjenkins_functions.sh | |
# $ itdjenkins_help | |
# | |
default_jenkins_url="http://itdjml01.unx.sas.com:8080" | |
url=${JENKINS_URL:-$default_jenkins_url} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# copy from local to remote | |
tar zvcf - whatever/ | ssh user@host 'cat > whatever.tar.gz' | |
# copy from remote to local | |
ssh user@host 'tar cz folder/to/copy | tar -xvz |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[alias] | |
rmtag= !sh -c 'git tag -d $1 && git push origin :refs/tags/$1' - | |
# git rmtag myTagName |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# src: https://likegeeks.com/awk-command/ | |
# preprocessing section | |
BEGIN { | |
# Special variables | |
# RS - record separator (default=\n) | |
# FS - field separator (default=space or tab) | |
# OFS - output field separator (default=space) | |
# ORS - output record separator (default=\n) | |
# FIELDWIDTHS - |