Category Archivecommand-line
command-line 20 Feb 2010 02:11 pm
Install Script For Rails on Debian
The following works great on Rackspace’s Debian Virtual Servers and within 5 minutes you got a running rails instance.
apt-get update -y
apt-get upgrade -y
apt-get install dlocate -y
apt-get install build-essential libssl-dev libreadline5-dev zlib1g-dev -y
apt-get install sqlite3 -y
cd /usr/local/src
wget ftp://ftp.ruby-lang.org/pub/ruby/stable-snapshot.tar.gz
tar zxvf stable-snapshot.tar.gz
cd ruby
./configure && make && make install
ruby -v
ruby -ropenssl -rzlib -rreadline -e “puts :Hello”
cd /usr/local/src
wget http://rubyforge.org/frs/download.php/60718/rubygems-1.3.5.tgz
tar zxvf rubygems-1.3.5.tgz
cd rubygems-1.3.5
ruby setup.rb
gem install rails
apt-get install mysql-server mysql-client -y
apt-get install libmysql-ruby libmysqlclient15-dev -y
gem install mysql — –with-mysql-include=/usr/include –with-mysql-lib=/usr/lib
gem install mongrel –include-dependencies
apt-get install git -y
How-To & command-line & git 08 Jul 2009 10:03 pm
Git: How to Cherry Pick Commits and Package them Under a Tag
I’ve pretty much come to rely on git to pull me out of any bad jams in the chaotic environment I work in.
One thing I’ve had to learn to do is cherry pick commits and package them under a tag in git.
Here’s how to do it if you were working with my newLISP project called Sitebeagle:
fork sitebeagle on this page
cd sitebeagle
git fetch –tags
git checkout 8f5bb33a771f7811d21b8c96cec67c28818de076
git checkout -b sample_cherry_pick
git cherry-pick 22aab7
git cherry-pick b1334775
git diff sample_cherry_pick..master
git tag leaving_out_one_commit
git push origin –tags
At this point, you should have a tagged branch that doesn’t have the commit with the change to the “2nd file.” The diff should look exactly like this:
diff –git a/test.lsp b/test.lsp
index 9cf1667..158b625 100755
— a/test.lsp
+++ b/test.lsp
@@ -1,6 +1,7 @@
#!/usr/bin/newlisp
; test tag test_a
+; cherry pick test 2
(load “sitebeagle.lsp”)
(load “twitter.lsp”);
WebApps & command-line & sysadmin 28 Mar 2009 04:09 pm
Doing Sysadmin on the iPhone
For checking up on sites in the enterprise, I use Alertsite. It was suggested to me by a VP I work with at McCann, Ed Recinto. It’s been a great tool.
For personal websites that I manage, I’ve been using something I rolled in newLISP, sitebeagle. Why? Because beagles are great watchdogs.
Very often, most problems can be solved with tweaking code, changing permissions, or upgrading and apache or mysql.
Very often, it’s the weekend, I’m sitting in a cafe, and get an alert from Nagios or Alertsite. With iSSH, on the iPhone, I can ssh into a LAMP server and do the work I need.
I can see things getting a bit more complex. What tools do you use to sysadmin from an iPhone?
command-line & scalability hacking 26 Feb 2009 10:39 pm
Oddments: A Great Blog For Keeping Up With Drizzle and Gearman
Alan Kasindorf just introduced me to a great blog by Eric Day, Oddments.
If you are into learning about alternatives to MySQL like Drizzle, or how to scale writes to a database using Gearman, then I wholeheartedly recommend his blog.
I really like the samples of code he puts up that acts as a very useful, and direct tutorial to new technologies.
How-To & WebApps & command-line 22 Jan 2009 11:45 pm
Setting Up a newLISP Webserver
How fast can you get on the web? With newLISP it’s about as fast as typing:
How fast can you create a backdoor with newLISP?
If you telnet into port 1234 in localhost, you’ll see something that looks like this:
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
newLISP v.10.0.0 on OSX IPv4 UTF-8.
>
This opens up a lot of possibilities for distributed computing.
For example, you can set up a newLISP server that’s ready to respond to a newLISP client with this command:
Your newLISP client can have code that sends a computing problem to be solved to the server:
Or let’s say you had a farm of newLISP servers:
(set ‘result (net-eval ‘(
(“192.168.1.100″ 4711 {(+ 3 4)})
(“192.168.1.101″ 4711 {(+ 5 6)})
(“192.168.1.102″ 4711 {(+ 7 8)})
(“192.168.1.103″ 4711 {(+ 9 10)})
(“192.168.1.104″ 4711 {(+ 11 12)})
) 1000))
(println “result: ” result)
(exit)
If the above example reminds you of Gearman, you get +12 points.
How-To & TechBiz & command-line 22 Jan 2009 08:39 am
The Infamous Zed Shaw Declares ACL Is Dead
If you work with ACL, this may be the most important video you watch ever. Zed shows how ACL is not Turing complete, which explains all the problems you’ve been having with control lists.
Zed Shaw – The ACL is Dead from CUSEC on Vimeo.
How-To & TechBiz & command-line 20 Jan 2009 10:12 am
Setting Up An EC2 LAMP Server
Pre-requisites:
- An EC2 account. Click on the sign-up for ec2 button.
- Some version of *nix.
- Download the ec2 tools.
- Generated an ec2 keypair.
Now we’re ready to build an EC2 LAMP Server.
You’ll find that a lot of ec2 stuff happens in the .ec2 directory.
To list the possible servers that you can set up run:
I ran
and got 1477 possible servers. Some are Windows.
Let’s say we see this listing:
If we want to start up the ubuntu server listed above we just type:
And then we run this command:
We should see either “pending” or the actual instance running with its FQDN listed in the 4th column. An example FQDN is this:
ec2-173-33-159-95.compute-1.amazonaws.com
And if we go to:
http://ec2-173-33-159-95.compute-1.amazonaws.com/
we should see a webserver.
And if we ssh:
we’ll get the root prompt:
#~
That’s basically it. Now you can go in and mess around with server settings.
In the next blog post, we’ll look at how to save your custom server settings and set up using S3.
How-To & command-line 14 Dec 2008 02:08 pm
Apps That Seem to Crash WoW on OS X 10.5.5
I wrote this quick script to take care of apps that seem to Crash OS X 10.5.5 on my Macbook Pro. I have just 1GiB of RAM instead of the recommended 2GiB, but ever since killing the processes in the script below, I haven’t had a crash.
The bad guys are:
- Google Updater
- Cross Over
- HPEventHandler
- HP IO Classic Proxy
- HP IO Classic Proxy 2
I killed privoxy in my script below just to get more memory to run Warcraft.
C1=`ps ax | grep Cross | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
C1=`ps ax | grep “Google Updater” | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
C1=`ps ax | grep “HPEventHandler” | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
C1=`ps ax | grep “HP IO Classic Proxy 2″ | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
C1=`ps ax | grep “HP IO Classic Proxy \-” | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
C1=`ps ax | grep “privoxy” | grep -v grep | cut -c3-6`
echo “C1: $C1″
kill -9 $C1
How-To & WebApps & command-line & ruby 30 Oct 2008 09:30 am
A Quick Guide to Noobwatcher
mv showchange.pl $HOME/bin
svn co http://codebelay.com/noobwatcher
mkdir watched_repositories
cd watches_repositories
cp $HOME/noobwatcher/trunk/noobwatcher.rb .
svn co
Create and edit a settings.yml file. Mine looksl like this:
repo: http://www.example.com/the_repo_I_am_watching
diffs: /Users/barce/nooblive/diffs
twitter_email: the_twitter_email_that_notifies_you@example.com
twitter_password: the_password_to_the_twitter_email_that_notifies_you
twitter_recipient: your_twitter_account
sleepseconds: 60
Start noobwatcher:
How-To & command-line 23 Oct 2008 02:21 pm
Remove ^M characters and more with repl.bash
Hey folks, this is a goody but quicky.
First off, respect the character encoding of a file. I don’t know how many devs out there violate this rule, but if you’re like me and Joel On Software, you’ll agree that you should respect the character encoding of a file.
If you happen to see that your file has gotten code page 1252 aka Windows-Latin 1 in it, then you’ll have a variety of random characters like ^M or ?~@~Y or ?~@~\ or ?~@~] .
Well, I wrote a script that removes these guys and makes sure that the file format of Unix is respected. Here it is:
#
# By: barce[a t]codebelay.com
# ——————-
# this script replaces microsoft special chars with plain ol’ ascii
#
# usage: ./repl.bash filename
#
# replace ^M characters
perl -pi -e ’s/\x{0D}\x{0A}/\x{0A}/g’ $1
# replace garbage with single-quotes
# ?~@~Y
perl -pi -e ’s/\x{E2}\x{80}\x{99}/\x{27}/g’ $1
perl -pi -e ’s/\x{80}\x{99}/\x{27}/g’ $1
perl -pi -e ’s/\x{80}\x{9c}/\x{27}/g’ $1
perl -pi -e ’s/\x{80}\x{9d}/\x{27}/g’ $1
# replace garbage with asterisk
# ?~@?
# e280 a2
perl -pi -e ’s/\x{E2}\x{80}\x{A2}/\x{2A}/g’ $1
# replace garbage quotes with plain quotes
# start: ?~@~\
# close: ?~@~]
# e2 809c
perl -pi -e ’s/\x{E2}\x{80}\x{9C}/\x{22}/g’ $1
perl -pi -e ’s/\x{E2}\x{80}\x{9D}/\x{22}/g’ $1
# replace garbage hyphens with plain hyphens
perl -pi -e ’s/\x{E2}\x{80}\x{93}/\x{2D}/g’ $1
# replace garbage with ellipsis
perl -pi -e ’s/\x{E2}\x{80}\x{A6}/\x{2E}\x{2E}\x{2E}/g’ $1