Skip to content

Instantly share code, notes, and snippets.

yang wzyuliyang

Block or report user

Report or block wzyuliyang

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:4e376b026bb99ff64b3cf15f61789129
Use TCPDUMP to Monitor HTTP Traffic
1. To monitor HTTP traffic including request and response headers and message body:
tcpdump -A -s 0 'tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
2. To monitor HTTP traffic including request and response headers and message body from a particular source:
tcpdump -A -s 0 'src example.com and tcp port 80 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)'
3. To monitor HTTP traffic including request and response headers and message body from local host to local host:
View progressbar.sh
echo -ne '##### (33%)\r'
sleep 1
echo -ne '############# (66%)\r'
sleep 1
echo -ne '####################### (100%)\r'
echo -ne '\n'
View install-instance.sh
# script instance
echo 172.23.113.5 vod-rpm >> /etc/hosts
sed -i 's/name=/enabled=0\nname=/g' /etc/yum.repos.d/*.repo
#add repo
cat << EOF > /etc/yum.repos.d/vod-centos6.repo
[VodCentos6-Repository]
name=Vod Centos6 - Local
baseurl=http://vod-rpm/centos6/Packages
@wzyuliyang
wzyuliyang / github_repo.py
Created Nov 7, 2016 — forked from toast38coza/github_repo.py
An Ansible module for managing github repos
View github_repo.py
#!/usr/bin/python
DOCUMENTATION = '''
---
module: github_repo
short_description: Manage your repos on Github
'''
EXAMPLES = '''
- name: Create a github Repo
@wzyuliyang
wzyuliyang / git-export
Created Oct 28, 2016 — forked from kristofferh/git-export
"Export" a git repository to zip file
View git-export
git archive --format zip --output /full/path/to/zipfile.zip master
@wzyuliyang
wzyuliyang / pyenv.sh
Created Oct 14, 2016 — forked from clozed2u/pyenv.sh
Install python 2.7.10 with pyenv on centos 7
View pyenv.sh
# install python 2.7.10 with pyenv on centos 7
yum install -y gcc gcc-c++ make git patch openssl-devel zlib-devel readline-devel sqlite-devel bzip2-devel
git clone git://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> .bashrc
echo 'eval "$(pyenv init -)"' >> .bashrc
pyenv install 2.7.10
pyenv global 2.7.10
View ceph-graphite.py
#!/usr/bin/env python
import time
import socket
import subprocess
import json
graphite_host = 'my.graphite.machine'
graphite_port = 2003
prefix = 'ceph'
@wzyuliyang
wzyuliyang / ceph-rest-api.wsgi
Created Oct 11, 2016 — forked from wido/ceph-rest-api.wsgi
Ceph REST API WSGI wrapper
View ceph-rest-api.wsgi
'''
WSGI wrapper for the Ceph REST API to be run behind Apache with mod_wsgi.
Place this script in /var/www as ceph-rest-api.wsgi and use this VirtualHost:
<VirtualHost *:80>
DocumentRoot /var/www
ServerName ceph-rest-api
ErrorLog /var/log/apache2/error.log
@wzyuliyang
wzyuliyang / ceph-graphite-pool-stats.py
Created Oct 11, 2016 — forked from wido/ceph-graphite-pool-stats.py
Send Ceph pool statistics to Graphite
View ceph-graphite-pool-stats.py
#!/usr/bin/env python
'''
This script gathers pool statistics from RADOS and sends them to a Graphite server
It allows you to graph and see what each pool is doing.
Author: Wido den Hollander <wido@widodh.nl>
'''
View ceph-udev-disk-scheduler.rules
# udev rule to set disk schedulers for Ceph
# For spinning disks we want the CFQ scheduler so that we can set
# priorities on client and recovery I/O threads
#
# Author: Wido den Hollander <wido@42on.com>
# Date: July 2015
# Use deadline for SSDs
ACTION=="add|change", KERNEL=="sd[a-z]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="deadline"
You can’t perform that action at this time.