Skip to content

Instantly share code, notes, and snippets.

Avatar
🎩
refactor everything

Michael K tsal

🎩
refactor everything
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am tsal on github.
  • I am tsalaroth (https://keybase.io/tsalaroth) on keybase.
  • I have a public key ASCRU6scfikjIJi2pr2nuugpLpOHg2-KHaWlsba1ZoqOjwo

To claim this, I am signing this object:

@tsal
tsal / sftp.yaml
Created Jun 14, 2020 — forked from jujhars13/sftp.yaml
kubernetes pod example for atmoz/sftp
View sftp.yaml
apiVersion: v1
kind: Namespace
metadata:
name: sftp
---
kind: Service
apiVersion: v1
metadata:
@tsal
tsal / Windows10AWSEC2.md
Created Feb 25, 2020 — forked from peterforgacs/Windows10AWSEC2.md
Running Windows 10 on AWS EC2
View Windows10AWSEC2.md

Running Windows 10 on AWS EC2

Downloading the image

Download the windows image you want.

AWS vmimport supported versions: Microsoft Windows 10 (Professional, Enterprise, Education) (US English) (64-bit only)

So Home wont work.

@tsal
tsal / main.go
Last active Oct 29, 2019
go temperature conversion
View main.go
package main
import (
"example/pkg/temperature"
"fmt"
)
func main() {
t := convert.New(0, convert.Celsius)
fmt.Println(t.F())
@tsal
tsal / text_adv-part-1.go
Last active Oct 26, 2019 — forked from scottjbarr/text_adv-part-1.go
Writing a Text Adventure Game in Go - Part 1 (uses a *Location for Game.CurrentLocation)
View text_adv-part-1.go
package main
import (
"fmt"
"math/rand"
"time"
)
type Game struct {
Welcome string
@tsal
tsal / ordinals.py
Last active Oct 21, 2019
ordinals example
View ordinals.py
def switch_suffix(digit):
switch = {
1: "st",
2: "nd",
3: "rd",
}
return switch.get(digit % 10, "th")
ordinals = [i+1 for i in range(10)]
@tsal
tsal / moarExample output.md
Last active Aug 31, 2019
strings are first class
View moarExample output.md
>>> ",".join("get all the words as a list then make them a csv".split())
'get,all,the,words,as,a,list,then,make,them,a,csv'
@tsal
tsal / send-sms.go
Created Feb 26, 2019 — forked from ivajloip/send-sms.go
Sending an SMS Text Message using AWS SNS service in GoLang
View send-sms.go
//assumes you have the following environment variables setup for AWS session creation
// AWS_SDK_LOAD_CONFIG=1
// AWS_ACCESS_KEY_ID=XXXXXXXXXX
// AWS_SECRET_ACCESS_KEY=XXXXXXXX
// AWS_DEFAULT_REGION=us-east-1
package main
import (
"fmt"
View The Three Go Landmines.markdown

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
View cpanismagic.md
$ perl -MMail::RFC822::Address=valid -e 'valid("example@example.com")'
$ echo $?
0
$