Skip to content

Instantly share code, notes, and snippets.

View willgarcia's full-sized avatar
🌴

William Garcia willgarcia

🌴
  • Brisbane, Australia
View GitHub Profile
@willgarcia
willgarcia / ticker.go
Created March 29, 2021 11:33 — forked from MortenDHansen/ticker.go
GoLang ticker - every second for ... time
package main
import "time"
import "fmt"
func main() {
tickerChannel := time.NewTicker(1 * time.Second)
go func() {
for {
select {
@willgarcia
willgarcia / deleteOldSnapshots.sh
Created September 15, 2020 11:52 — forked from yufufi/deleteOldSnapshots.sh
Scripts to manage AKS Disk snapshots
# set the expiry to a month ago
expirydate=$(date -d'-1 month' +%s)
# I can use az -o table with cut -d driectly
for snapshot in $(az snapshot list -g $resourceGroup | jq -r '.[] | [.id, .timeCreated[:10], .name] | join("#")')
do
snapshotId=$(echo $snapshot | cut -f1 -d "#")
snapshotDate=$(echo $snapshot | cut -f2 -d "#" | xargs -I{} date -d {} +%s)
snapshotName=$(echo $snapshot | cut -f3 -d "#")
@willgarcia
willgarcia / istio-gke-kiali
Created May 14, 2020 03:55 — forked from lucasponce/istio-gke-kiali
Install Istio in Google Kubernetes Engine + Update Kiali to latest
[0] Pre-requisites
Install google-cloud-sdk in your laptop
Documentation: https://cloud.google.com/sdk
Install helm in your laptop.
Documentation: https://helm.sh/docs/using_helm/#installing-helm
Get latest Istio.
curl -L https://git.io/getLatestIstio | ISTIO_VERSION=1.1.7 sh -

How to setup AWS lambda function to talk to the internet and VPC

I'm going to walk you through the steps for setting up a AWS Lambda to talk to the internet and a VPC. Let's dive in.

So it might be really unintuitive at first but lambda functions have three states.

  1. No VPC, where it can talk openly to the web, but can't talk to any of your AWS services.
  2. VPC, the default setting where the lambda function can talk to your AWS services but can't talk to the web.
  3. VPC with NAT, The best of both worlds, AWS services and web.
@willgarcia
willgarcia / gist:487b50c76902f7358909
Last active September 9, 2015 10:38 — forked from hd-deman/gist:d856151147ab9c3c3564
Downgrade Boot2Docker and Docker from 1.5.0 to 1.4.1 on OS X
* brew tap homebrew/boneyard
* cd $( brew --prefix )
* brew versions docker
git_hash = $(brew versions docker | awk '$1 == "1.4.1" {print $4}')
* git checkout $git_hash Library/Formula/docker.rb
* brew unlink docker
* brew install docker
* brew switch docker 1.4.1
* docker --version

Description

When using Homebrew (http://brew.sh) and searching formulas or pull requests you may get the dreaded error message: Github API Rate limit exceeded

Let's fix that! (yeah!)


Short version

Create a new Personal Token in your Github Account Settings (Sidebar: Applications) and then copy the Token. In the Terminal, use export HOMEBREW_GITHUB_API_TOKEN=YOURAPITOKENWITHFUNKYNUMBERSHERE (change that to your API Token) or add that to your .bash_profile and then do source .bash_profile.