Skip to content

Instantly share code, notes, and snippets.

View stanchan's full-sized avatar
🏠
Working from home

Stan Chan stanchan

🏠
Working from home
View GitHub Profile
@stanchan
stanchan / skip_loop.go
Created January 27, 2017 05:54
Skip or discard items of non-interest when iterating example
/**
##
# User Database
#
# Note that this file is consulted directly only when the system is running
# in single-user mode. At other times this information is provided by
# Open Directory.
#
# See the opendirectoryd(8) man page for additional information about
# Open Directory.
cat << EOF >> curl_format.txt
\n
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
@stanchan
stanchan / config.xml
Created February 20, 2017 12:00
Initial Jenkins config.xml
<?xml version='1.0' encoding='UTF-8'?>
<hudson>
<disabledAdministrativeMonitors/>
<version>1.0</version>
<numExecutors>4</numExecutors>
<mode>NORMAL</mode>
<useSecurity>true</useSecurity>
<authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
<securityRealm class="hudson.security.SecurityRealm$None"/>
<disableRememberMe>false</disableRememberMe>
-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false
@stanchan
stanchan / mutually_exclusive_options.py
Created March 17, 2017 00:01
Python Click Mutually Exclusive Options
from click import command, option, Option, UsageError
class MutuallyExclusiveOption(Option):
def __init__(self, *args, **kwargs):
self.mutually_exclusive = set(kwargs.pop('mutually_exclusive', []))
help = kwargs.get('help', '')
if self.mutually_exclusive:
ex_str = ', '.join(self.mutually_exclusive)
kwargs['help'] = help + (
' NOTE: This argument is mutually exclusive with '
@stanchan
stanchan / plugins.txt
Created April 21, 2017 18:29
Jenkins Android/IOS Build Plugins
active-directory
analysis-core
android-lint
ansicolor
ant
antisamy-markup-formatter
artifactory
blueocean
build-failure-analyzer
build-monitor-plugin
@stanchan
stanchan / gen-ssl-cert.sh
Created April 28, 2017 17:43
SSL Key Generator
#!/bin/bash
printusage() {
echo
echo "Usage: $0 [-c FQDN] [-p PREFIX] [-h HASHSIZE] [-k KEYSIZE] [-e EXPIRATION] [-src override.txt]"
echo -e "\t\t\t [-f openssl.cnf] [-o /directory] [-nopass] [-noks] [-nots]"
echo "---------------------------------"
echo " -c FQDN Specify the common name for certificate"
echo " -p PREFIX Set the filename prefix"
echo " -h HASHSIZE Specify hash size (default: 512)"
@stanchan
stanchan / hosts
Created May 13, 2017 18:30
Kargo Ansible Hosts
kubernetes-devtest-master0 ansible_ssh_host=10.10.197.92 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
kubernetes-devtest-worker0 ansible_ssh_host=10.10.201.8 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
kubernetes-devtest-worker1 ansible_ssh_host=10.10.222.7 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
kubernetes-devtest-etcd0 ansible_ssh_host=10.10.202.189 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
kubernetes-devtest-etcd1 ansible_ssh_host=10.10.214.248 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
kubernetes-devtest-etcd2 ansible_ssh_host=10.10.193.149 ansible_user=ubuntu ansible_become=true ansible_python_interpreter=/usr/bin/python3
bastion ansible_ssh_host=34.210.177.249 ansible_user=ubuntu ansible_become=true
bastion ansible_ssh_host=34.210.182.27 ansible_user=ubuntu ansible_become=true
@stanchan
stanchan / java.sh
Created May 17, 2017 23:07
Java Profile
#!/bin/sh
export JAVA_HOME=/usr/java/jdk
export JRE_HOME=$JAVA_HOME/jre
export J2RE_HOME=$JAVA_HOME/jre
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$J2RE_HOME/bin:$PATH
@stanchan
stanchan / .ignore
Created July 19, 2017 15:27
ignore
.DS_Store
.vagrant
**/*.retry
inventory/devtest/hosts
inventory/**/hosts.bak
inventory/vagrant_ansible_inventory
inventory/**/group_vars/fake_hosts.yml
inventory/**/host_vars/
temp
.idea