Skip to content

Instantly share code, notes, and snippets.

View ohmystack's full-sized avatar

JiangJun ohmystack

View GitHub Profile
@ohmystack
ohmystack / atom-sync-settings
Last active November 8, 2016 10:44
My Atom editor settings (automatic update by http://atom.io/packages/sync-settings )
We couldn’t find that file to show.
@ohmystack
ohmystack / heapster.yaml
Created September 29, 2016 08:42
Heapster (new add-on config for Kubernetes >=1.4)
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: heapster-v1.2.0
namespace: kube-system
labels:
k8s-app: heapster
kubernetes.io/cluster-service: "true"
version: v1.2.0
spec:
@ohmystack
ohmystack / goroutine_id.go
Last active December 5, 2016 03:18
Golang gists
func goID() int {
var buf [64]byte
n := runtime.Stack(buf[:], false)
idField := strings.Fields(strings.TrimPrefix(string(buf[:n]), "goroutine "))[0]
id, err := strconv.Atoi(idField)
if err != nil {
panic(fmt.Sprintf("cannot get goroutine id: %v", err))
}
return id
}
#!/usr/bin/env python
# Copyright (C) 2006 by Johannes Zellner, <johannes@zellner.org>
# modified by mac@calmar.ws to fit my output needs
# modified by crncosta@carloscosta.org to fit my output needs
import sys
import os
def echo(msg):
os.system('echo -n "' + str(msg) + '"')
[[local|localrc]]
# ========================
# All-in-one-node
# ========================
#
# TODO: Set this host's IP
HOST_IP=10.0.2.21
MULTI_HOST=1
DEST=/opt/stack
# For those unverified Linux releases, e.g. Ubuntu14.10
echo 52:54:$(dd if=/dev/urandom count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\)\(..\)\(..\).*$/\1:\2:\3:\4/')
>>> from datetime import datetime
>>> str(datetime.now())
'2011-05-03 17:45:35.177000'
>>> import string
>>> import random
>>> def id_generator(size=6, chars=string.ascii_uppercase + string.digits):
... return ''.join(random.choice(chars) for x in range(size))
...
>>> id_generator()
'G5G74W'
>>> id_generator(3, "6793YUIO")
'Y3U'
@ohmystack
ohmystack / localrc for grizzly
Last active December 29, 2015 17:19
My localrc for installing openstack stable/grizzly with quantum enabled using devstack
ADMIN_PASSWORD=<your_password>
MYSQL_PASSWORD=<your_password>
RABBIT_PASSWORD=<your_password>
SERVICE_PASSWORD=<your_password>
SERVICE_TOKEN=<your_password>
HOST_IP=127.0.0.1
disable_service n-net
enable_service q-svc
@ohmystack
ohmystack / Arrow
Created November 4, 2013 04:50
A simple arrow
+xxxxxxxxxx+
x x
x x
x x
x x
x x
x x