Skip to content

Instantly share code, notes, and snippets.

View dfang's full-sized avatar
🎯
Focusing

fang duan dfang

🎯
Focusing
View GitHub Profile
@dfang
dfang / ldflags.md
Last active June 6, 2019 01:07 — forked from ceccode/README.md
Go build LDFlags

Using the -ldflags parameter can help set variable values at compile time.

Using the example provided here:

  1. Running make build will create a build executable. Running it will result in:
$> ./build
no version (Mon YYYY)
$>
@dfang
dfang / Mac OSX Setup - Brew
Created March 31, 2019 15:30 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@dfang
dfang / Fastfile
Created December 19, 2018 13:28 — forked from candostdagdeviren/Fastfile
Android Fastfile Example for Flutter application Fastlane integration
default_platform(:android)
platform :android do
desc "Submit a new QA Build to Crashlytics Beta"
lane :qa do
crashlytics(
api_token: 'CRASHLYTICS_API_TOKEN',
build_secret: 'CRASHLYTICS_BUILD_SECRET',
notes_path: 'qa-change.log',
@dfang
dfang / README.md
Created November 25, 2018 13:22 — forked from snowyu/README.md
Shadowsocks proxy and ssh proxy

Shadowsocks Proxy

apt-get install python-pip
pip install shadowsocks

sudo ssserver -p 443 -k password -m aes-256-cfb --user nobody -d start
minikube start --extra-config=apiserver.authorization-mode=RBAC
kubectl create clusterrolebinding add-on-cluster-admin --clusterrole=cluster-admin --serviceaccount=kube-system:default
minikube dashboard
@dfang
dfang / deploy_minikube.sh
Created September 14, 2018 11:55 — forked from waja/deploy_minikube.sh
Install minikube on Debian / Ubuntu
#!/bin/sh
# install needed curl package
sudo apt install --no-install-recommends curl -y
# install kubectl
curl -Lo /tmp/kubectl https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && \
chmod +x /tmp/kubectl && \
sudo mv /tmp/kubectl /usr/local/bin/kubectl
# kubectl tab completion
sudo sh -c 'echo "source <(kubectl completion bash)" > /etc/bash_completion.d/kubectl'
# install needed packages for kvm (see https://github.com/kubernetes/minikube/blob/master/docs/drivers.md#kvm2-driver)
@dfang
dfang / README.md
Last active July 31, 2018 03:24 — forked from bruth/README.md
Postgres push notification

Postgres push triggers

Watch a table for changes and push a notification with a payload describing the change.

Example

In the Postgres shell:

-- Create the functions
@dfang
dfang / builder.go
Created May 15, 2018 09:47 — forked from vaskoz/builder.go
Golang Builder pattern
package main
import "strconv"
import "fmt"
type Color string
type Make string
type Model string
const (
@dfang
dfang / negroni-gorilla.go
Created April 30, 2018 13:43 — forked from danesparza/negroni-gorilla.go
Negroni with Gorilla mux subrouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
)
@dfang
dfang / converters.go
Created April 25, 2018 05:53 — forked from vishakvkt/converters.go
gorilla schema - convert html date
import(
"reflect"
"time"
"github.com/gorilla/schema"
)
func ConvertFormDate(value string) reflect.Value {
s, _ := time.Parse("2006-01-_2", value)
return reflect.ValueOf(s)
}