Author Archive

non-interventionism

Wednesday, January 4th, 2012

George Washington touted it best, notably in his farewell address “steer clear of entangling alliances” – I like this policy not only for my country but also for my individual person-hood. Why is it that the MSM (mainstream media) has to constantly refer to the concept as not what it is, but rather as isolationism. Why is it so hard to even consider this possibility; Think this, what if the USGOV didn’t interfere and play policeman in every issue in every country across the globe?

What if we didn’t have commitments to the French, British and others before the outbreak of WWI and WWII?

What good would come of this? What bad would come of this? What savings would come of this? What deficiencies would arise of this?

Think about this: You, as a individual person-hood, do you like when your mother gets involved in every aspect of your life? Why does our government need to get involved in the lives of others?

From Wikipedia article on non-interventionism

Nonintervention or non-interventionism is a foreign policy which holds that political rulers should avoid alliances with other nations, but still retain diplomacy, and avoid all wars not related to direct self-defense. This is based on the grounds that a state should not interfere in the internal politics of another state, based upon the principles of state sovereignty and self-determination. A similar phrase is “strategic independence”.[1] Historical examples of supporters of non-interventionism are US Presidents George Washington and Thomas Jefferson, who both favoured non-intervention in European Wars while maintaining free trade. Other proponents include United States Senator Robert Taft and United States Congressman Ron Paul.[2]

Non-intervention is distinct from and is not isolationism, the latter featuring economic nationalism (protectionism) and restrictive immigration. Proponents of non-interventionism distinguish their policies from isolationism through their advocacy of more open national relations, to include diplomacy and free trade.

From: http://en.wikipedia.org/wiki/Non-interventionism

comment out/affect mulitple lines in vi

Sunday, December 11th, 2011

Ever wanted to comment out multiple lines of code while writing shell scripts in vi, but didn’t want to pound your keyboard for half an hour doing it?

(I#Escape j.j.j.j. = carpal tunnel)

Here’s the nerdy way to do it:

:.,+N-1 s/^/#/g

Where N-1 is the number of lines minus one that you want to comment out, and s/^/#/g is the regular expression (the pattern between the first two slashes is what you want to replace, in this case the beginning of the line, and the pattern between the last two slashes is what you want to replace it with).

For example, if you’re a bad coder like me and want to comment out 500 lines of code, you would do:

:.,+499 s/^/#/g

linux-3.1.x power regression issues i915 core-i5,i7

Saturday, November 5th, 2011

there’s been a lot of talk about the power regression issues with the linux-3.x kernel on the new intel sandy bridge core i3,5,7 chipsets.

after spending several hours with this issue on a new thinkpad x220 laptop, i’ll share a solution thanks to the peeps over at #fedora-qa

***UPDATE – Kernel patch now available at LKML – https://lkml.org/lkml/2011/11/10/467 (i’ll report my results with this when I get a chance to build the patch rpm, i’ll post) As of now I’m still having issues with the iwlagn module.

fyi , i’m running fedora 16 RC5 x86_64 but these kernel parameters apply to any distro

you’ll want to pass the following parameters at runtime or at boot, however you like :

pcie_aspm=force power_save=3 i915.i915_enable_fbc=1 i915.i915_enable_rc6=1 i915.lvds_downclock=1

then generate a new grub2 (or 1.xx) config file and reinstall grub to your mba on the disk.

my results were pretty good. idle 70% lcd brightness from 16W to 7.5W average and 5.76W baseline. I’ve yet to tell but it seems at about 16 hour battery life.

you’ll also want irqbalance installed to take best advantage of power management balance, distribution and usage over the processors

finally, i use this bash script at runtime so further fine tune my acpi power usage

#!/bin/bash
echo 1 > /sys/module/snd_hda_intel/parameters/power_save

for i in /sys/class/scsi_host/host?/link_power_management_policy; do
echo min_power > $i
done

for i in /sys/bus/usb/devices/*/power/autosuspend; do
echo 1 > $i
done

for i in /sys/bus/{pci,i2c}/devices/*/power/control; do
echo auto > $i
done

echo 1 > /sys/devices/system/cpu/sched_mc_power_savings

echo 5 > /proc/sys/vm/laptop_mode
echo 0 > /proc/sys/kernel/nmi_watchdog
#echo Y > /sys/module/snd_ac97_codec/parameters/power_save
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings
echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
echo 60 > /proc/sys/vm/dirty_ratio
echo 20 > /proc/sys/vm/dirty_background_ratio
echo 1500 > /proc/sys/vm/dirty_expire_centisecs
for i in /sys/bus/usb/devices/*/power/autosuspend; do echo 1 > $i; done
# those sysctl’s are only available if you have an AHCI compatible SATA
# controler and use kernel > 2.6.24-rc2 (or use Kristen ALPM patchset) :
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy
echo min_power > /sys/class/scsi_host/host1/link_power_management_policy
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
ifconfig em1 down
ifconfig virbr0 down
/etc/init.d/libvirtd stop
rmmod bluetooth
hdparm -B 1 -S 12 /dev/sda > /dev/null
echo 1 > /proc/sys/vm/swappiness
service atd stop &> /dev/null
service cron stop &> /dev/null
service anacron stop &> /dev/null

Want to monitor your power usage with dstat? Try this

dstat -t -c –power –top-cpu –top-io –top-bio –top-latency –top-cputime –power –battery-remain 10

dealing with a sd2f file

Monday, August 15th, 2011

it took me a while to find out (on google) how to deal with a sd2f audio file. I figured I’d share the solution with others

I wanted to listen to a sd2f audio while. Further investigation revealed this is a ‘Toast’ File for Mac. I don’t run Mac OS, I run Linux

1- Download + Install audacity
– yum install -y audacity
– apt-get install audacity
2. Open the file
– Point File -> Import Raw Data
3. Export the file
– Point, File -> Export
– Select your audio export format of choice.
– Done.

Shout Out – RIP

Friday, June 17th, 2011

A lot of important people in my life have passed away this year. If wordpress/web publishing is today’s answer to the scribe , a complement to Gutenberg’s 600 year old press, then I’d like to put one in record.

Rest In Peace, to good friends who helped justify the mandate bestowed upon me aka. the course correction.

Julianne Laliberte (Jan 30, 2011)
David Ross Wolpoff (Dec 22, 2010)
Michael McDonald, Sr. (Oct 17, 2010)
Luke J Malloy ( Apr 21, 2010 )

May a candle be lit and the memories live on eternally. We shall meet again.

php-fpm /nGINX on CentOS-5.6-RELEASE

Friday, June 17th, 2011

We’ve skeeet enterprise baby … Want to be on your way to a load balanced lightning fast cached-up wordpress server with very little resources? Check up on this!

We dig RedHat, package names are standard and not as confusing as Debian/Ubuntu. This new standard world is new to us. Ridin` with the King!

yum install openssl-devel curl-devel curl libjpeg-devel libjpeg libpng libmcrypt mysql++-devel freetype-devel freetype t1lib-devel t1lib t1utils libc-client-devel libc-client bzip2-devel bzip2-libs libevent-devel libevent gd-devel gd-progs gd libxml2-devel libxml2 expat-devel expat sqlite-devel sqlite libjpeg-devel libpng-devel libmcrypt-devel
mysql-devel gcc pcre-devel redhat-lsb-graphics libexif ImageMagick

Now follow rest of directions here: . You will need to build libmemcached from source, however. I will post further instructions later for all inquiring minds.

But for sho` , if you are running x_86_64 you will need to use the –with-libdir=lib64 when you configure php, other-wise you haz problems with libmysqlclient (script won’t know where to find mySQL)

Optimizing Webservers for PHP / WordPress: Wordcamp 2010

Saturday, October 2nd, 2010

aid to presentation:

if fresh debian install make sure you’ve before anything, as root;

apt-get install build-essential openssl-server sudo postfix

sudo apt-get install libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev libmcrypt-dev libmysql++-dev libfreetype6-dev libt1-dev libc-client-dev libbz2-dev mysql-client libevent-dev libxml2-dev mysql-server libmysqlclient15-dev libgd2-xpm-dev libeventdb-dev libexpat1-dev libsqlite3-dev

php 5.3.3 from source

wget http://tw2.php.net/distributions/php-5.3.3.tar.bz2
tar xjvf php-5.3.3.tar.bz2
./configure –enable-fpm –with-mcrypt –enable-mbstring –with-openssl –with-mysql –with-mysql-sock –with-gd –with-jpeg-dir=/usr/lib –enable-gd-native-ttf –with-pdo-mysql –with-libxml-dir=/usr/lib –with-mysqli=/usr/bin/mysql_config –with-curl –enable-zip –enable-sockets –with-zlib –enable-exif –enable-ftp –with-iconv –with-gettext –enable-gd-native-ttf –with-t1lib=/usr –with-freetype-dir=/usr –prefix=/usr/local/php –with-fpm-user=www-data –with-fpm-group=www-data –with-pear
make
sudo make install
make clean

libevent 1.4.13
wget http://www.monkey.org/~provos/libevent-1.4.13-stable.tar.gz
./configure && make
sudo make install
make clean

nginx 0.7.67

wget http://nginx.org/download/nginx-0.7.67.tar.gz
tar xzvf nginx-0.7.67.tar.gz
./configure –sbin-path=/usr/local/sbin –with-http_ssl_module –without-mail_pop3_module –without-mail_imap_module –without-mail_smtp_module –with-http_stub_status_module
make
sudo make install
make clean

sudo mkdir -p /usr/local/nginx/{sites-available,sites-enabled}

memcached
wget http://launchpad.net/libmemcached/1.0/0.44/+download/libmemcached-0.44.tar.gz
tar xzfv libmemcached-0.44.tar.gz
./configure && make
sudo make install
make clean
sudo apt-get install sqlite3 memcached
sudo pecl install memcache

configuration files

fastcgi_params
nginx.conf
php-fpm.conf
php.ini
sample_vhost_nginx.conf
wordpress_params.regular
wordpress_params_cache

init.d scripts
nginx
php-fpm

if any of this is unclear, please contact me so that we can make it easier for anyone who searches for it. let’s take down the notion that apache is the only webserver good enough for production.

That thing

Tuesday, August 10th, 2010

One evening he spoke. Sitting at her feet, his face raised to her, he allowed his soul to be heard. “My darling, anything you wish, anything I am, anything I can ever be… That’s what I want to offer you — not the things I’ll get for you, but the thing in me that will make me able to get
them. That thing — a man can’t renounce it — but I want to renounce it — so that it will be yours — so that it will be in your service — only for you.”

The girl smiled and asked: “Do you think I’m prettier than Maggie Kelly?”

He got up. He said nothing and walked out of the house. He never saw that girl again. Gail Wynand, who prided himself on never needing a lesson twice, did not fall in love again in the years that followed.
– Ayn Rand, “The Fountainhead”

Introduction to Pip, Virtualenv & virtualenvwrapper

Sunday, August 8th, 2010

A Brief presentation for the Manila Python Hackers Guild meetup. Join the Facebook page here

apache/mod_wsgi vs. uwsgi

Tuesday, August 3rd, 2010

Quick note to self. I was blown away by siege tests this afternoon.

Two servers, identical
Server Hardware
linux kernel 2.6.32-12
512MB RAM

siege -c 90 –time=120s
server 1= running apache 2.2 with mod_wsgi with nginx 0.7.35 as front end wwwsvr.
Lifting the server siege… done.
Transactions: 2735 hits
Availability: 100.00 %
Elapsed time: 120.21 secs
Data transferred: 9.17 MB
Response time: 3.38 secs
Transaction rate: 22.75 trans/sec
Throughput: 0.08 MB/sec
Concurrency: 77.00
Successful transactions: 2735
Failed transactions: 0
Longest transaction: 11.08
Shortest transaction: 0.16

vs.
siege -c 90 –time=120s
no apache, nginx 0.7.35 with uwsgi
Lifting the server siege… done.
Transactions: 20605 hits
Availability: 100.00 %
Elapsed time: 120.06 secs
Data transferred: 74.51 MB
Response time: 0.03 secs
Transaction rate: 171.62 trans/sec
Throughput: 0.62 MB/sec
Concurrency: 4.82
Successful transactions: 20605
Failed transactions: 0
Longest transaction: 9.02
Shortest transaction: 0.01

Who said you need apache?

siege -c 250 –time=30s
apache/mod_wsgi
Lifting the server siege… done.
Transactions: 185 hits
Availability: 100.00 %
Elapsed time: 30.01 secs
Data transferred: 0.62 MB
Response time: 7.69 secs
Transaction rate: 6.16 trans/sec
Throughput: 0.02 MB/sec
Concurrency: 47.42
Successful transactions: 185
Failed transactions: 0
Longest transaction: 27.10
Shortest transaction: 0.15

nginx/uwsgi
Lifting the server siege… done.
Transactions: 8147 hits
Availability: 100.00 %
Elapsed time: 29.60 secs
Data transferred: 29.46 MB
Response time: 0.39 secs
Transaction rate: 275.24 trans/sec
Throughput: 1.00 MB/sec
Concurrency: 108.68
Successful transactions: 8145
Failed transactions: 0
Longest transaction: 21.02
Shortest transaction: 0.01

uwsgi was able to serve 8147 requests to 250 concurrent connections in the same time mod_wsgi could only serve 185