Skip to content

Instantly share code, notes, and snippets.

View cheyang's full-sized avatar
💭
I may be slow to respond.

cheyang cheyang

💭
I may be slow to respond.
View GitHub Profile
@cheyang
cheyang / git.migrate
Created February 11, 2018 23:48 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
@cheyang
cheyang / dockerpsns.sh
Created January 14, 2018 10:17 — forked from brendangregg/dockerpsns.sh
docker ps --namespaces
#!/bin/bash
#
# dockerpsns - proof of concept for a "docker ps --namespaces".
#
# USAGE: ./dockerpsns.sh
#
# This lists containers, their init PIDs, and namespace IDs. If container
# namespaces equal the host namespace, they are colored red (this can be
# disabled by setting color=0 below).
#
@cheyang
cheyang / git-tag-delete-local-and-remote.sh
Created December 9, 2017 15:02 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
package main
import (
"flag"
"fmt"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/pkg/api/v1"
"k8s.io/client-go/tools/clientcmd"
)
@cheyang
cheyang / kubectl.md
Created November 24, 2017 09:34 — forked from so0k/kubectl.md
Playing with kubectl output

Kubectl output options

Let's look at some basic kubectl output options.

Our intention is to list nodes (with their AWS InstanceId) and Pods (sorted by node).

We can start with:

kubectl get no
# General
datetime (If you want to revert to the hardware clock being in UTC, do:)
`timedatectl set-local-rtc 0`
## Docker
Also making sure we can do docker commands without sudo
```
yaourt -S --noconfirm docker
usermod -a -G docker $USER
@cheyang
cheyang / Dockerfile
Created June 10, 2017 13:47 — forked from colthreepv/Dockerfile
Concourse CI inside Docker compose v2
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache \
openssh
RUN mkdir -p /keys/web /keys/worker
CMD ssh-keygen -t rsa -f /keys/web/tsa_host_key -N '' && \
ssh-keygen -t rsa -f /keys/web/session_signing_key -N '' && \
'''
Distributed Tensorflow example of using data parallelism and share model parameters.
Trains a simple sigmoid neural network on mnist for 20 epochs on three machines using one parameter server.
Change the hardcoded host urls below with your own hosts.
Run like this:
pc-01$ python example.py --job-name="ps" --task_index=0
pc-02$ python example.py --job-name="worker" --task_index=0
pc-03$ python example.py --job-name="worker" --task_index=1
pc-04$ python example.py --job-name="worker" --task_index=2
More details here: ischlag.github.io
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.
#!/bin/bash
# This script is used to compile Tensorflow Serving protobuf definition into Python
# The generated definitions in Python are stored in the tensorflow_serving_apis folder
# Usage:
# ./compile_ts_serving_proto.sh 333325e413e9680d67ae90196fa123f5271fcf615
#
: ${1?”Error. Please provide the Tensorflow Serving git commit hash/branch name. Usage: ./compile_ts_serving_proto.sh my_awesome_branch “}
script_dir=”$( cd$( dirname “${BASH_SOURCE[0]})&& pwd )
ts_git_revision=$1 #branch/release or commit hash
local_ts_api_dir=”${script_dir}/tensorflow_serving_apis/” #directory that stores the compiled python proto definition