Skip to content

Instantly share code, notes, and snippets.

@charz
charz / custom.js
Created September 26, 2013 08:59 — forked from drewjoh/custom.js
$(document).ready(function() {
// Support for AJAX loaded modal window.
// Focuses on first input textbox after it loads the window.
$('[data-toggle="modal"]').click(function(e) {
e.preventDefault();
var url = $(this).attr('href');
if (url.indexOf('#') == 0) {
$(url).modal('open');
} else {
@charz
charz / Sample for p4python
Created December 18, 2013 02:47
Login to Perforce server, create a workspace and sync code to specific changelist number.
#!/env/bin/python
from P4 import P4, P4Exception
import json
p4 = P4()
p4.user = "charz"
p4.password = "mypassword"
p4.port = "tcp:192.168.1.2:1666"
p4.client = "auto-build"
@charz
charz / release_archive
Created January 23, 2014 03:08
Create a zip archive with git version
#!/bin/bash
SRC=pkg-name
VER=`cd ${SRC}; git describe`
echo 'Try to pack: '${VER}
cp -a ${SRC} ${SRC}_v${VER}
tar czvf ${SRC}_v${VER}.tar.gz --exclude .git --exclude ".git*" ${SRC}_v${VER}
@charz
charz / .vimrc
Last active August 29, 2015 13:56
My vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
Bundle 'gmarik/vundle'
Bundle 'Lokaltog/vim-easymotion'
@charz
charz / .prompt
Created March 4, 2014 08:20
My console prompt
# add git prompt, charles
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/'
}
function proml {
local BLUE="\[\033[0;34m\]"
local LBLUE="\[\033[1;34m\]"
local RED="\[\033[0;31m\]"
local LRED="\[\033[1;31m\]"
@charz
charz / 1_upgrade_kernel.sh
Last active August 29, 2015 13:57
A batch files to install docker in ubuntu 12.04
#!/bin/bash
# install the backported kernel
sudo apt-get update
sudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring
# reboot
sudo reboot
@charz
charz / gist:d02c8cacbd241339e87d
Created August 6, 2014 01:35
Connection closed by peer
Aug 5 18:29:56 kin-paco02 object-server: ERROR __call__ error with PUT /192.168.15.102%3A8123/270/AUTH_test/ssbench_0000207/207 : #012Traceback (most recent call last):#012 File "/usr/local/lib/python2.7/dist-packages/swift/obj/server.py", line 682, in __call__#012 res = method(req)#012 File "/usr/local/lib/python2.7/dist-packages/swift/common/utils.py", line 2422, in wrapped#012 return func(*a, **kw)#012 File "/usr/local/lib/python2.7/dist-packages/swift/common/utils.py", line 1023, in _timing_stats#012 resp = func(ctrl, *args, **kwargs)#012 File "/usr/local/lib/python2.7/dist-packages/swift/obj/server.py", line 391, in PUT#012 orig_metadata = disk_file.read_metadata()#012 File "/usr/local/lib/python2.7/dist-packages/swift/obj/diskfile.py", line 1353, in read_metadata#012 with self.open():#012 File "/usr/local/lib/python2.7/dist-packages/kinetic_swift-0.1-py2.7.egg/kinetic_swift/obj/server.py", line 139, in open#012 self._read()#012 File "/usr/local/lib/python2.7/dist-packages/kinet
@charz
charz / gist:903adf3e1a955133d22f
Created August 6, 2014 01:39
Test single drives with single server
TIMESTAMP=`date +%s`
for i in {1..300};
do
curl -X PUT http://192.168.1.82:6000/192.168.15.102%3A8123/270/AUTH_test/ssbench_0000${i}/${i} -H "content-type: application/data" -H "x-timestamp: ${TIMESTAMP}" -T testfile_1KB &
done
wait
@charz
charz / with_output-no-prefix (for Patch Set 1)
Last active August 29, 2015 14:16
example of --output-no-prefix (for Patch Set 1)
(pyswiftclient)[21:56][][charles@CharzMac: /tmp/test ] $ swift list charz --prefix f1/etc
f1/etc/account-server.conf-sample
f1/etc/container-reconciler.conf-sample
f1/etc/container-server.conf-sample
f1/etc/container-sync-realms.conf-sample
f1/etc/dispersion.conf-sample
f1/etc/drive-audit.conf-sample
f1/etc/memcache.conf-sample
f1/etc/mime.types-sample
f1/etc/object-expirer.conf-sample
@charz
charz / check_object_0629.md
Last active August 29, 2015 14:23
FA is missing .durable file and can't retrieve object from object server in 40% disk failure in EC6+4

Available nodes

## qa01
swiftqa@swiftqa01:~$ ls -al /srv/node*/d*/objects-3/2170/972/87a0767a119155053615399f030dd972
total 28172
drwxr-xr-x 2 swift swift       44 Jun 25 12:55 .
drwxr-xr-x 3 swift swift       53 Jun 25 12:55 ..
-rw------- 1 swift swift 28841598 Jun 25 12:55 1435236883.13246#9.data

## qa04