Skip to content

Instantly share code, notes, and snippets.

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Ubuntu 12.04 with support for cgroup, I installed the package cgroup-bin and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@pyKun
pyKun / openstack-one.sh
Last active August 29, 2015 14:04
QEMU notes
/usr/libexec/qemu-kvm \
-name instance-00000001 \
-S -M rhel6.5.0 -no-kvm -m 512 \
-realtime mlock=off \
-smp 1,sockets=1,cores=1,threads=1 \
-uuid c6761dd9-f3f1-49c4-a9de-136f0bad6d8a \
-smbios type=1,manufacturer=Red Hat Inc.,product=OpenStack Nova,version=2014.1.1-3.el6,serial=564de42d-269e-f49a-6c7a-59f14f4e4b9c,uuid=c6761dd9-f3f1-49c4-a9de-136f0bad6d8a \
-nodefconfig \
-nodefaults \
-chardev socket,id=charmonitor,path=/var/lib/libvirt/qemu/instance-00000001.monitor,server,nowait \
@pyKun
pyKun / mdserv
Created July 24, 2014 06:11 — forked from smoser/mdserv
#!/usr/bin/python
"""
To use this to mimic the EC2 metadata service entirely, run it like:
# where 'eth0' is *some* interface. if i used 'lo:0' i got 5 second or so delays on response.
sudo ifconfig eth0:0 169.254.169.254 netmask 255.255.255.255
sudo ./mdserv 169.254.169.254:80
Then:
wget -q http://169.254.169.254/latest/meta-data/instance-id -O -; echo
curl --silent http://169.254.169.254/latest/meta-data/instance-id ; echo
[global]
index-url=http://pypi.openstack.org/openstack/
Protecting hybrid cloud environments from being breached
<https://www.openstack.org/summit/tokyo-2015/vote-for-speakers/presentation/3591>
System Domination: Config Management and Image Deployment
<https://www.openstack.org/summit/tokyo-2015/vote-for-speakers/presentation/3592>
Duct-tape, Bubblegum, and Bailing Wire
<https://www.openstack.org/summit/tokyo-2015/vote-for-speakers/presentation/3606>
Load Balancing as a Service, Liberty and Beyond
//videos.cdn.redhat.com/summit2015/presentations/11500_racing-camel-with-bpm-and-red-hat-jboss-fuse.pdf
//videos.cdn.redhat.com/summit2015/presentations/13875_harnessing-big-data-with-hortonworks-data-platform-red-hat-jboss-data-virtualization.pdf
//videos.cdn.redhat.com/summit2015/presentations/12218_use-openshift-paas-to-accelerate-devops-continuous-delivery.pdf
//videos.cdn.redhat.com/summit2015/presentations/11322_whats-new-with-red-hat-jboss-operations-network.pdf
//videos.cdn.redhat.com/summit2015/presentations/13622_process-driven-application-development-using-red-hat-jboss-bpm-suite.pdf
//videos.cdn.redhat.com/summit2015/presentations/15846_strategy-vision-for-red-hat-management-solutions.pdf
//videos.cdn.redhat.com/summit2015/presentations/17850_development-architecture-for-application-centric-microservices-deployment-in-the-intercloud.pdf
//videos.cdn.redhat.com/summit2015/presentations/17854_red-hat-ceph-storage-and-network-solutions-for-software-defined-infrastructure-sdi.pdf
//videos.cdn.redhat.c
@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 / 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