Installing Sublime Text 2 on Linux Mint 12 or Ubuntu

I have been using sublime text along side with vim for a while now and so far this is my Notepad++ replacement. This editor is fast, light weight, very customizable and really slick looking. the license costs 59 USD but an evaluation version can be downloaded for free, however a pop-up will show every some number of save.

I have defined my shortcuts just the same as Notepad++, this helped me migrate to sublime much easier. When you enter “Vintage mode” your editor will become VIM.

The Pane on the right side is effective when searching text because the text will be enclosed on a oblong and will be visible in the code overview Pane.

Installing Sublime

 

Download the version 2.0.1. Note: you can get the latest version’s downlink link at http://www.sublimetext.com/2

 wget "http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%202.0.1.tar.bz2"

 

Extract the version 2.0.1

 tar -jxvf Sublime Text 2.0.1.tar.bz2

 

Add to your $PATH variable

adding to your $PATH means you can launch sublime using “sublime_text” command on your terminal or launcher. Be sure to add restart your bash profile by restarting or logging out and loggin on your desktop/laptop.
echo "export PATH=$PATH:`pwd`" >> ~/.bash_profile

random number in MySQL with range

I am creating a prototype that needs to simulate adding IDs from 1-7. Since i’m lazy i updated the new column with a random numnber.

SELECT FLOOR(RAND()*7)+1

MySQL has a rand() function which will give you a floating point, multiply it by the range you need and add 1.

Note: this post serves as a note for future reference

Pebble watch was backed up $10m through crowd funding

 

Pebble Watch was backed up $10m through Crowd Funding site kickstarter.com

This watch uses a 144 x 168 low-power Sharp Memory LCD display. It uses an android or Apple Device to transmit data to the watch through bluetooth, a bike App can send GPS and speedometer data and display it on the watch. Have you been annoyed to received a text while running? This watch can send you alerts and even let’s you read SMS texts while you run. Watch faces can be customized too and Apps can talk to the watch. Battery life is no problem as it last 7 days.

The price $150 a watch. http://getpebble.com/

COMPATIBILITY

iPhone 3GS, 4, 4S running iOS 5 or any iPod Touch with iOS 5. Android devices running OS 2.3 and up. Works great with Android 4.0 (Ice Cream Sandwich)! Unfortunately Pebble does not work with Blackberry, Windows Phone 7, or Palm phones at this time

Threadless, Philippine Customs and ridiculous tax rates

That’s a whopping 36.79% TAX!!!!

Last week we ordered thirteen shirts at threadless.com ranging from $9.99 to $14.00. The total bill was $196.72 (13 shirts $148.40 + $48.32 UPS Express Saver 1-3 days shipping time), this is roughly PHP 8,350.

However yesterday i was informed that the custom has held our shipment because we need to pay taxes. i am not sure how this was computed but the total tax was PHP 3,072, that’s a whopping 36.79% TAX!!!! Back in 2010 we shipped eight shirts from the same website and we paid no taxes. A friend told me that they might thought that our goods are for sale because of the quantity and charged us higher taxes.

Fix Ubuntu Unity theme on virtual box

ever wonder why your ubuntu unity is showing windows classic theme instead of the cool unity theme?

execute the following on your virtualbox ubuntu and fix the problem
note: this is just a quick fix and you need to re-execute this when your restart your VM

killall -9 gnome-settings-daemon && gnome-settings-daemon

Find big files on linux

A quick post to remember a useful snippet to find big files inside a linux machine

Command

this command shows the full path of the File <colon> Date <colon> Size

find / -type f -size +1G -exec ls -lh {} ; | awk '{ print $9 " : " $6"-"$7 ": " $5 }'

Output

Output shows files bigger than 1gb

[root@RSENDBE01 data]# find / -type f -size +1G -exec ls -lh {} ; | awk '{ print $9 ": " $5 }'
/var/lib/mongo/ECOM-LOGS.9: 2.0G
/var/lib/mongo/ECOM-LOGS.6: 2.0G
/var/lib/mongo/ECOM-LOGS.8: 2.0G
...
...

.com Domain lookup bash script

i’ve been hoarding few domains on my own and i just created a script to easily check available domains but does not check if it is an expiring domains.

Domains.txt

first you need to create your domains.txt that has all the domains you want to check without the “.com”

# domains.txt
bluefin
sampledomain1953checker
sampledomain1954check
sampledomain3353checker

The dotcomchecker.sh

#!/bin/sh
# author: http://almar.io
# date: April 14, 2012
# this script checks for .com domains, available domains will
# appear in the screen but taken domains will be ommitted
DOMAINSTXT="domains.txt"

counter=1;
cat $DOMAINSTXT | grep -v "^#" | while read DOMAIN
do
	whois $DOMAIN.com | grep "No match";
	counter=$((counter+1));

	# pause for a while to avoid being blocked from whois
	if [ "$counter" -gt "8" ]; then
		sleep 10;
	fi
done

just be sure to add executable permission to your file

 chmod +x dotcomchecker.sh

How to use and output

kalmario@StuffedCrust-Mint12 /tmp/domainchecker $ sh dotcomchecker.sh 
No match for "SAMPLEDOMAIN1953CHECKER.COM".
No match for "SAMPLEDOMAIN1954CHECK.COM".
No match for "SAMPLEDOMAIN3353CHECKER.COM".
kalmario@StuffedCrust-Mint12 /tmp/domainchecker $

the uses of .bash_profile and .bashrc

Difference of .bash_profile and .bashrc

.bash_profile is the one being executed upon login on your machine. mostly you add diagnostic commands (uptime, disk space utilization, iostats, etc) that you want to be shown upon login.

.bashrc file determines the behavior of interactive shells. every aliases and functions you put on this file will be available even when you open a new terminal window.

 .bash_profile’s usefulness

On my bash_profile. I always show diagnostic information that i want to be shown upon login ONLY. below is my basic .bash_profile

echo "----- Server Load -----"
mkdir diagnostics -p
uptime > diagnostics/load_avg-`date +%F_%H:%M`.txt
cat diagnostics/load_avg-`date +%F_%H:%M`.txt

echo "----- Disk Space -----"
df -h > diagnostics/disk_space-`date +%F_%H:%M`.txt
cat diagnostics/disk_space-`date +%F_%H:%M`.txt

I always keep a diagnostic folder on my home folder for easier retrieval.

Continue reading

ssh connection always gets disconnected

Last week, when i came back from lunch all my ssh connection has been terminated. It does not show any error message and won’t respond to any command. I tried pressing enter and ctrl+c but to no avail. This problem will be very annoying when you need to copy a file via scp and in the middle of the process the connection dropped or you are executing a long process and you forgot to put it under a screen

it seems ssh is not sending signals to keep the connection alive or the interval is too long that the connection timed out. To remedy this you need to edit your ssh_config

sudo vim /etc/ssh/ssh_config

and add this line to keep your ssh connection alive

ServerAliveInterval 5