Skip to content

Instantly share code, notes, and snippets.

@timoyuen
timoyuen / mirror-docker-registries.sh
Created July 5, 2018 06:58 — forked from steve-jansen/mirror-docker-registries.sh
Mirror a Docker Trusted Registry (DTR) to another registry
#!/bin/bash
read -p "Registry to clone from: " pull_registry
read -p "Username for $pull_registry: " user
read -s -p "Password for $pull_registry: " password
echo
read -p "Registry to clone onto: " push_registry
echo Querying $pull_registry...
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: internal-docker-registry
labels:
app: docker-registry
type: development
spec:
replicas: 1
selector:
@timoyuen
timoyuen / curl.md
Last active June 2, 2018 09:41 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@timoyuen
timoyuen / iptables_rules.sh
Created May 30, 2018 23:43 — forked from virtualstaticvoid/iptables_rules.sh
25 Most Frequently Used Linux IPTables Rules Examples
# Modify this file accordingly for your specific requirement.
# http://www.thegeekstuff.com
# 1. Delete all existing rules
iptables -F
# 2. Set default chain policies
iptables -P INPUT DROP
iptables -P FORWARD DROP
iptables -P OUTPUT DROP
@timoyuen
timoyuen / KongJwt.md
Created May 21, 2018 06:33 — forked from martinheld/KongJwt.md
Short example to use JWT with Kong

JWT Kong Example

  • Get and Start Kong and Co
git clone [email protected]:Mashape/docker-kong.git
cd docker-kong/compose
docker-compose up
  • Create Kong API Route
@timoyuen
timoyuen / main.dart
Created May 16, 2018 14:06 — forked from mikemimik/main.dart
Flutter: Custom theme data
import 'package:flutter/material.dart';
import 'theme.dart' as Theme;
void main() {
runApp(
new MaterialApp(
title: 'CompanyApp',
color: Theme.CompanyColors.blue[500],
theme: Theme.CompanyThemeData,
home: new Scaffold(
def trapBOM(fileBytes []byte) []byte{
trimmedBytes := bytes.Trim(fileBytes, "\xef\xbb\xbf")
return trimmedBytes
}
@timoyuen
timoyuen / gist:f1d28caf24ef8aab7af4473d4987d5f2
Created May 11, 2018 08:16
An example of a JSON Unmarshal into a Go struct.
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
type Artist struct {
@timoyuen
timoyuen / slice_exists.go
Created May 11, 2018 04:45 — forked from r6m/slice_exists.go
golang check if item exists in slice
package main
import(
"fmt"
"reflect"
)
func main() {
items := []int{1,2,3,4,5,6}
fmt.Println(SliceExists(items, 5)) // returns true
@timoyuen
timoyuen / http_get.go
Created May 8, 2018 07:50 — forked from ijt/http_get.go
Example of using http.Get in go (golang)
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
)