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 / 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 / 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 / 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 / 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 '
-Djava.awt.headless=true -Djenkins.install.runSetupWizard=false
@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>
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 / 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.
@stanchan
stanchan / config_slurper.go
Created January 27, 2017 05:52
Read data from config file and assign to variables
/**
[profile manager]
key=value
password = sjssh31mmv
; a comment
port = 8080
ip = 123.456.789.321
# another comment
url=example.com
file=
@stanchan
stanchan / gist:d3f56bc5cce899925e25032e2da7e577
Created January 17, 2017 01:31 — forked from cridenour/gist:74e7635275331d5afa6b
Setting up Vim as your Go IDE

Setting up Vim as your Go IDE

The final IDE

Intro

I've been wanting to do a serious project in Go. One thing holding me back has been a my working environment. As a huge PyCharm user, I was hoping the Go IDE plugin for IntelliJ IDEA would fit my needs. However, it never felt quite right. After a previous experiment a few years ago using Vim, I knew how powerful it could be if I put in the time to make it so. Luckily there are plugins for almost anything you need to do with Go or what you would expect form and IDE. While this is no where near comprehensive, it will get you writing code, building and testing with the power you would expect from Vim.

Getting Started

I'm assuming you're coming with a clean slate. For me this was OSX so I used MacVim. There is nothing in my config files that assumes this is the case.