Skip to content

Instantly share code, notes, and snippets.

@mba811
mba811 / toutiao_typora.css
Created June 12, 2021 05:34 — forked from theshiau/toutiao_typora.css
Bytedance Toutiao Theme for Typora
/*Editor*/
#write {
max-width: 700px;
margin: 0 auto;
padding: 30px;
padding-bottom: 100px;
}
/*Preview*/
body {
font-family: -apple-system, helvetica, sans-serif;
#Variable declaration
$vCenterIPorFQDN="192.168.243.40"
$vCenterPort="443"
$vCenterUsername="[email protected]"
$vCenterPassword="vmware"
$DatacenterFolder="DCFolder"
$DatacenterName="Datacenter"
$MgmtClusterName="MgmtCluster"
$OpenStackClusterNames=@("OpenStackCluster") #Cluster(s) managed by OpenStack
$MgmtHosts= @("192.168.243.144") #IP or FQDN of hosts participating in Management Cluster
@mba811
mba811 / turbo-qiniu.sh
Created November 26, 2015 12:29 — forked from trawor/turbo-qiniu.sh
本脚本解决部分地区七牛上传速度慢的问题
#!/bin/bash
#
# 通过对比 ping 响应时间,找到本机最快的上传ip
# [email protected]
#
function refresh_host()
{
IP="$1"
UPLOAD_HOST="upload.qiniu.com"
@mba811
mba811 / gist:71764ca4024bcfe73648
Last active November 24, 2015 13:08 — forked from ody/gist:5718115
puppetlabs-openstack
---
# Data needed for Class['openstack::compute']
# The IP and interface that external sources will use to communicate with the instance and hypervisors.
openstack::compute::public_interface: 'eth0'
openstack::compute::internal_address: "%{ipaddress_eth0}"
openstack::compute::iscsi_ip_address: "%{ipaddress_eth0}"
# The interface that will handle instance to intance communication and instance outbound traffic.
openstack::compute::private_interface: 'eth1'
# OSX for Hackers (Mavericks/Yosemite)
#
# Source: https://gist.github.com/brandonb927/3195465
#!/bin/sh
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Ask for the administrator password upfront

Zero downtime deploys with unicorn + nginx + runit + rvm + chef

Below are the actual files we use in one of our latest production applications at Agora Games to achieve zero downtime deploys with unicorn. You've probably already read the GitHub blog post on Unicorn and would like to try zero downtime deploys for your application. I hope these files and notes help. I am happy to update these files or these notes if there are comments/questions. YMMV (of course).

Other application notes:

  • Our application uses MongoDB, so we don't have database migrations to worry about as with MySQL or postgresql. That does not mean that we won't have to worry about issues with the database with indexes being built in MongoDB or what have you.
  • We use capistrano for deployment.

Salient points for each file:

@mba811
mba811 / .zshrc
Last active August 29, 2015 14:17
# for golang
# mkdir $HOME/go
# mkdir -p $GOPATH/src/github.com/user
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
@mba811
mba811 / gist:ab21661c65b11ef738d5
Created March 10, 2015 10:00 — forked from tkambler/gist:5222d276f783def5ece8
Today Scripts:个性化 Yosemite 通知栏-Displaying Tabular Data
#!/usr/local/bin/node
var Table = require('cli-table');
var table = new Table({
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
style: { 'padding-left': 0, 'padding-right': 0 }
@mba811
mba811 / gist:24bdba2ed54c06825dbc
Last active August 29, 2015 14:16 — forked from tkambler/gist:5222d276f783def5ece8
Today Scripts:个性化 Yosemite 通知栏-Notification Center
#!/usr/local/bin/node
var Table = require('cli-table');
var table = new Table({
chars: { 'top': '' , 'top-mid': '' , 'top-left': '' , 'top-right': ''
, 'bottom': '' , 'bottom-mid': '' , 'bottom-left': '' , 'bottom-right': ''
, 'left': '' , 'left-mid': '' , 'mid': '' , 'mid-mid': ''
, 'right': '' , 'right-mid': '' , 'middle': ' ' },
style: { 'padding-left': 0, 'padding-right': 0 }
@mba811
mba811 / storageusage.sh
Last active August 29, 2015 14:16 — forked from SamRothCA/storageusage.sh
Today Scripts:个性化 Yosemite 通知栏-Storage volume
df -Hl | {
read keys;
keys="${keys%% on}";
while read ${keys//%}; do
echo "`basename "$Mounted"` - $Used/$Size ($Capacity)";
done
}