This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString* path=[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"]; | |
path=[path stringByAppendingPathComponent:@"Downloads"]; | |
NSString *filename = nil; | |
NSDictionary *attrs = nil; | |
NSDirectoryEnumerator* dirEnum = [[NSFileManager defaultManager] enumeratorAtPath:path]; | |
[dirEnum skipDescendants]; | |
while (filename = [dirEnum nextObject]) { | |
NSUInteger level = [dirEnum level]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
df | awk 'NR==2' | awk '{print int($3/$4 * 100)}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yum install gmp-devel | |
# vim /etc/yum.repos.d/epel.repo | |
--- | |
[epel] | |
name=RHEL 6 - epel - $releasever - $basearch | |
baseurl=http://download.fedoraproject.org/pub/epel/beta/6/$basearch/ | |
gpgcheck=0 | |
enabled=1 | |
priority=1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sudo su | |
// install apache | |
# yum -y install httpd | |
// install develop tools for installing ghc | |
# yum -y install gcc | |
// install ghc 7.4.2 | |
# wget http://www.haskell.org/ghc/dist/7.4.2/ghc-7.4.2-x86_64-unknown-linux.tar.bz2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ifconfig en0 | awk 'NR==5' | cut -d ' ' -f 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// memory usage percent (integral) | |
free | awk 'NR==2' | awk '{print int($3/$2*100)}' | |
// actual memory usage (integral) | |
// http://open-groove.net/linux-command/free/ | |
free | awk 'NR==2' | awk '{print int(($3-($6+$7))/$2*100)}' | |
// swap memory usage percent (integral) | |
free | awk 'NR==4' | awk '{print int($3/$2*100)}' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cpu usage (decimal) | |
cat /proc/loadavg | cut -d ' ' -f 1 | |
# cpu usage (integral) | |
cat /proc/loadavg | cut -d ' ' -f 1 | cut -d '.' -f 1 | |
# cpu usage (integral * 100) | |
cpu=`cat /proc/loadavg | cut -d ' ' -f 1`;echo $cpu*100 | bc | cut -d '.' -f 1 | |
# send your cpu usage (integral) to GrowthForecast every 5 minutes via crontab |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo yum groupinstall "Development Tools" | |
$ sudo yum install pkgconfig glib2-devel gettext libxml2-devel pango-devel cairo-devel | |
$ cd /usr/bin/ | |
$ sudo curl -LOk http://xrl.us/cpanm | |
$ sudo chmod +x cpanm | |
$ sudo cpanm local::lib | |
-> FAIL Installing ExtUtils::MakeMaker failed. See /root/.cpanm/build.log for details. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cd /usr/bin/ | |
$ sudo curl -LOk http://xrl.us/cpanm | |
$ sudo chmod +x cpanm | |
$ sudo cpanm local::lib | |
-> FAIL Installing ExtUtils::MakeMaker failed. See /root/.cpanm/build.log for details. | |
-> FAIL Bailing out the installation for App-cpanminus-1.5018. Retry with --prompt or --force. | |
$ sudo yum install perl-devel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Fuel\Migrations; | |
class Create_users | |
{ | |
public function up() | |
{ | |
\DBUtil::create_table('users', array( | |
'id' => array('constraint' => 11, 'type' => 'int', 'auto_increment' => true), |