Skip to content

Instantly share code, notes, and snippets.

@pyKun
pyKun / dhcp-white-list
Last active December 16, 2015 09:09
two example of dhcp config file for white list (mac addr) in linux
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
# see 'man 5 dhcpd.conf'
#
ddns-update-style interim;
ignore client-updates;
next-server 192.168.1.160;
filename "/pxelinux.0";
@pyKun
pyKun / pymega
Created May 12, 2013 07:46
megacli python client
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
# Created Time: 05/09/13 11:04:46 (CST)
# Modified Time: 05/12/13 15:35:42 (CST)
# do raid 1 more better
# do raid with hot
# remvoe all hot
import argparse
@pyKun
pyKun / centos.ustack
Last active February 10, 2022 18:53
Worked kickstart file for a standard centos
# centos_minimal_livecd.ks
# Created by AndrewSerk
part / --size 8192 --fstype ext4
lang en_US.UTF-8
keyboard us
timezone US/Eastern
auth --useshadow --enablemd5
selinux --disabled
firewall --disabled
@pyKun
pyKun / ks.cfg
Created May 12, 2013 07:52
mirantis kickstart file for a cloud node
install
text
%include /tmp/source.ks
reboot --eject
lang en_US.UTF-8
keyboard us
rootpw r00tme
timezone --utc Etc/UTC
zerombr
firewall --disabled
#!/bin/bash
# Source: http://toomuchdata.com/2012/06/25/how-to-install-python-2-7-3-on-centos-6-2/
yum groupinstall "Development tools"
yum install zlib-devel
yum install bzip2-devel openssl-devel ncurses-devel
wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar xf Python-2.7.3.tar.bz2
cd Python-2.7.3
@pyKun
pyKun / boto_test_cors.py
Last active December 17, 2015 18:18
test swift3 middleware
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
# Created Time: 05/24/13 11:47:24 (CST)
# Modified Time: 05/27/13 16:15:33 (CST)
import boto
from boto.s3.connection import S3Connection
conn= S3Connection(
#!/usr/bin/env python
"""Split large file into multiple pieces for upload to S3.
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux
box images we need to use boto's multipart file support.
This parallelizes the task over available cores using multiprocessing.
Usage:
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>]
@pyKun
pyKun / test_xattr.sh
Created June 9, 2013 10:04
test swift object server xattr support
truncate -s 50MB hk.img
mkfs.vfat hk.img
mount hk.img /srv/node -o loop
swift-object-server start
#!/usr/bin/env python
"""Split large file into multiple pieces for upload to S3.
S3 only supports 5Gb files for uploading directly, so for larger CloudBioLinux
box images we need to use boto's multipart file support.
This parallelizes the task over available cores using multiprocessing.
Usage:
s3_multipart_upload.py <file_to_transfer> <bucket_name> [<s3_key_name>]
@pyKun
pyKun / keep_exc.py
Last active December 19, 2015 12:28
over covering on sys.exc_info()
#!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: Kun Huang <academicgareth@gmail.com>
# Created Time: 06/06/13 22:23:18 (CST)
# Modified Time: 07/09/13 12:03:40 (CST)
import sys
try:
raise ValueError('ddd')
except Exception as dd:
dd_exc = sys.exc_info()