Posts Tagged ‘Linkedin’
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
Tags:Carpal Tunnel, Half An Hour, Keyboard, Linkedin, Regular Expression, Shell Scripts, Slashes, vi, Writing Scripts
Posted in *nix | No Comments »
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
Tags:5w, Ac97 Codec, acpi, Background Ratio, Bash Script, Bus Pci, Bus Usb, Echo 1, Echo 5, Fedora, Hda, Host Host, Host Link, i915, Kernel 2, Kernel Parameters, Kernel Patch, Linkedin, Linux Kernel, linux-3, Lvds, Management Policy, Ondemand, power consumption, Power Management, powertop, Rc6, Sysctl, System Cpu, thinkpad x220, ubuntu, X Power
Posted in *nix | No Comments »
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.

Tags:Audacity, Export Format, File Point, Google, Linkedin, Linux, Mac Os, Raw Data, Toast Mac, Yum
Posted in *nix | No Comments »
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)
Tags:Bzip2, centos, Fpm, Freetype, Gcc, Inquiring Minds, Libjpeg, Libpng, Libxml2, Lightning, Linkedin, Nginx, Package Names, Php, php-fpm, Server Check, Sqlite, Yum
Posted in *nix | No Comments »
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.
Tags:Dev Php, Distributions, Fpm, Gd, Libxml2, Linkedin, Mail Imap, Mail Pop3, Mail Smtp, Mysql Client, Nginx, Pear, Provos, Sockets, Ssl Module, Tar Bz2, Tar Xzvf, Team Solution, Ttf, Tw2, Usr Bin, Webservers, wordcamp philippines 2010, Xpm
Posted in Uncategorized | 1 Comment »
Sunday, August 8th, 2010
A Brief presentation for the Manila Python Hackers Guild meetup. Join the Facebook page here
Tags:cheeseshop, Django, Hackers, Linkedin, Pip, Presentation, Python, slides, Team Solution, virtualenv, virtualenvwrapper
Posted in Django | No Comments »
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
Tags:Apache 2, Apache Server, Blown Away, C 250, Concurrency, Concurrent Connections, Hardware Linux, Kernel 2, Linkedin, Linux, mod_wsgi, Nginx, Note To Self, Response Time, Running, Server Hardware, Servers, Throughput, Time 3, Transaction Rate, uwsgi
Posted in Django, Internetworking | No Comments »
Thursday, July 22nd, 2010
each time i pull a new bash shell, i’m enlightened by /usr/bin/fortune
this one time caught me off guard and I had to share it.
Young men are fitter to invent than to judge; fitter for execution than for
counsel; and fitter for new projects than for settled business. For the
experience of age, in things that fall within the compass of it, directeth
them; but in new things, abuseth them. The errors of young men are the ruin
of business; but the errors of aged men amount but to this, that more might
have been done, or sooner. Young men, in the conduct and management of
actions, embrace more than they can hold; stir more than they can quiet; fly
to the end, without consideration of the means and degrees; pursue some few
principles which they have chanced upon absurdly; care not how they innovate,
which draws unknown inconveniences; and, that which doubleth all errors, will
not acknowledge or retract them; like an unready horse, that will neither stop
nor turn. Men of age object too much, consult too long, adventure too little,
repent too soon, and seldom drive business home to the full period, but
content themselves with a mediocrity of success. Certainly, it is good to
compound employments of both … because the virtues of either age may correct
the defects of both.
– Francis Bacon, “Essay on Youth and Age”
Tags:Bash Shell, Compass, Employments, Execution, Fly, Fortune, Francis Bacon, Inconveniences, Linkedin, Mediocrity, New Projects, One Time, Ruin, Virtues, Young Men
Posted in 2nd Declaration of Independence | No Comments »
Friday, June 11th, 2010
I’m adding this to my checklist when exporting a virtual machine via virtualbox.
on the guest image,
- become superuser
- echo “” > /etc/udev/rules.d/70-persistent-net.rules
- shutdown -r now
- open up the 70 persistent net rules again. change eth1 to eth0
- shutdown -h now
- go ahead and export (VBoxManage export $image_name -o $image_name.ovf)
For me, this saved a lot of asprin when importing VM on a new machine. This permits udev to assign the first available eth adpater to your machines virtual mac address.
Tags:Asprin, D 70, Export Image, Image Name, Linkedin, Mac Address, Ovf, Udev, Virtual Mac, Virtual Machine, Virtualbox
Posted in *nix, Internetworking | No Comments »
Wednesday, June 9th, 2010
I really enjoyed this article from the blog of Swaroop CH
In it he de-mystifies all the hoopla about innovation, creativity and boils it down to two basic ideas.
Solving a Problem,
then,
Implementing a Solution.
That’s it really folks,
Read Swaroop’s Article Here.
Cheers Swaroop, keep it coming!
also check out:
10 Laws of Productivity
The Discipline of Creativity, P. Drucker
Tags:All The Hoopla, Blog, Boils, Cheers, creative impact, discipline, Innovation Creativity, Linkedin, Organization Impact, peter drucker, Productivity, self improvement, startup company
Posted in 2nd Declaration of Independence | No Comments »