Skip to content

Instantly share code, notes, and snippets.

View goby's full-sized avatar

laidonglin goby

  • Hangzhou, Zhejiang, China
View GitHub Profile
#!/usr/bin/env python
# Copyright 2017 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@goby
goby / copy_remotely
Last active January 10, 2018 06:55 — forked from aseigneurin/copy_remotely
Ansible module to copy a file if the MD5 sum of the target is different
#!/usr/bin/python
ANSIBLE_METADATA = {
'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'
}
DOCUMENTATION = '''
---
module: copy_remotely
https://lampjs.wordpress.com/2017/01/19/easy-installing-arch-linux-dual-boot-with-windows-uefi-or-mbr-for-beginners/
@goby
goby / smooth-retry-test.go
Last active October 11, 2017 06:30
A demo indicates a smooth retry-after time base on ratelimit
package main
import (
"fmt"
"math/rand"
"sync/atomic"
"time"
"github.com/juju/ratelimit"
)
@goby
goby / local.conf
Created September 17, 2017 05:09
DevStack local configuration for OpenStack
# This file consists master and computer nodes
# by goby@2017-08-02
#
# Nodes:
# Master: 10.166.224.132
# Compute: 10.166.224.133
#
# Remarks:
# git proxy/https proxy should be set because of the fucking GFW
#
@goby
goby / ipables-parser.pejs
Last active August 28, 2017 08:26
iptables parser for iptables-save(8), and output a structed result
/*
* Parse iptables-restore(8) rulesets ,multiple rules seperated by ";"
* https://pegjs.org
*
* Author: goby <goby@foxmail.com> @2017-08-26
*/
{
/* deep copy from on to another */
function merge(left, right){
/*
* Parse ip-route(8) rulesets ,multiple rules seperated by ";"
* https://pegjs.org
*
* Author: goby <goby@foxmail.com> @2017-08-25
*/
{
/* deep copy from on to another */
function merge(left, right){
@goby
goby / awslambda
Created August 10, 2017 06:23 — forked from mhart/awslambda
node_modules/awslambda
#!/usr/bin/env node
var path = require('path')
var fs = require('fs')
var lib = path.join(path.dirname(fs.realpathSync(__filename)), '../lib');
require(lib + '/awslambda.js').start_runtime();
@goby
goby / ca.md
Created December 24, 2016 15:07 — forked from soarez/ca.md
How to setup your own CA with OpenSSL

How to setup your own CA with OpenSSL

For educational reasons I've decided to create my own CA. Here is what I learned.

First things first

Lets get some context first.

screen -d -m -S stack -t shell -s /bin/bash
screen -r stack -X hardstatus alwayslastline '%{= .} %-Lw%{= .}%> %n%f %t*%{= .}%+Lw%< %-=%{g}(%{d}%H/%l%{g})'
screen -S stack -X screen -t key
screen -S stack -p key -X stuff 'cd /opt/stack/keystone && /opt/stack/keystone/bin/keystone-all --config-file /etc/keystone/keystone.conf --debug || echo "key failed to start" | tee "/opt/stack/status/stack/key.failure"^M'
screen -S stack -X screen -t g-reg
screen -S stack -p g-reg -X stuff 'cd /opt/stack/glance; /usr/local/bin/glance-registry --config-file=/etc/glance/glance-registry.conf || echo "g-reg failed to start" | tee "/opt/stack/status/stack/g-reg.failure"^M'
screen -S stack -X screen -t g-api
screen -S stack -p g-api -X stuff 'cd /opt/stack/glance; /usr/local/bin/glance-api --config-file=/etc/glance/glance-api.conf || echo "g-api failed to start" | tee "/opt/stack/status/stack/g-api.failure"^M'
screen -S stack -X screen -t n-api
screen -S stack -p n-api -X stuff 'cd /opt/stack/nova && /usr/local/bin/nova-api || ec