Skip to content

Instantly share code, notes, and snippets.

Avatar
🛠️

Paul Tyng paultyng

🛠️
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am paultyng on github.
  • I am paultyng (https://keybase.io/paultyng) on keybase.
  • I have a public key whose fingerprint is 5C7F DE00 84B8 A02C 1571 545F 7E44 81B7 24D4 4C66

To claim this, I am signing this object:

@paultyng
paultyng / aws_presign.go
Created Mar 24, 2020
Create AWS IoT MQTT Presign URL in Go
View aws_presign.go
package main
import (
"crypto/hmac"
"crypto/sha256"
"encoding/hex"
"fmt"
"net/url"
"strings"
"time"
@paultyng
paultyng / cmd.sh
Last active Sep 10, 2018
Gopkg.lock to vendor.json - dep to govendor
View cmd.sh
# tomljson from https://github.com/pelletier/go-toml
tomljson Gopkg.lock \
| jq '{ comment: "", ignore: "test", package: [.projects[] | . as $project | .packages[] | { path: ($project.name + if . == "." then "" else ("/" + .) end), revision: $project.revision } + if $project.version then { version: $project.version, versionExact: $project.version } else {} end], rootPath: "github.com/..." }'
@paultyng
paultyng / document.js
Last active Jun 15, 2017
Algolia - Material Document
View document.js
{
"asset": {
"url": "https://underarmour.scene7.com/is/image/Underarmour//1299081-025_LA?$size=279,360&hei=400&wid=310&$extend=0"
},
"catalogs": [
1824,
1825,
1897,
1898,
1899,
@paultyng
paultyng / jwtRS256.sh
Created Apr 17, 2017 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
View jwtRS256.sh
ssh-keygen -t rsa -b 4096 -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
View authentication.go
package auth
import (
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"os"
"regexp"
"time"
View ops.yaml
- name: update-user-email
title: Update User's Email
description: Update a user's email address.
db:
connection: users
sql: update users set email = :email where id = :id
schema:
properties:
id:
type: integer
View version_branch_to_tag.sh
#!/bin/bash
remote="${1:-origin}"
echo "Using remote $remote"
branches="$(git ls-remote --heads $remote | awk '{print $2}' | awk -F'/' '{print $3}' | grep '^v' | sort | uniq)"
echo "$branches" | while read branch; do
echo "Branch: $branch"
@paultyng
paultyng / kube-restart-counts.sh
Last active Sep 29, 2016
Get kubernetes restart counts > 0
View kube-restart-counts.sh
kubectl get pods -o json |
jq '.items[] | .metadata.name + " " + (.status.containerStatuses[].restartCount | tostring)' -r |
awk '$2 > 0 { print $1 " " $2 }'
@paultyng
paultyng / password.tf
Last active Nov 30, 2017
Terraform Random Password Module
View password.tf
variable "length" {
default = "20"
}
resource "random_id" "password" {
byte_length = "${var.length * 3 / 4}"
}
output "password" {
value = "${random_id.password.b64}"