Codecademy Google Chrome Web Store Shortcut

codecademy-chrome-store-shortcut

I am attempting to make it a habit to use Codecademy everyday for brain food. I’d like to work through all the lessons and complete Codecademy’s Code Year Track – I want it front and center everytime I open Google Chrome. I decided to quickly make a Chrome Web Store Shortcut for convenience. If you’d like to use it too, feel free to download it.

How do you add this to Google Chrome? Simple, extract the contents of the .zip file to a nice location (I used Dropbox so I can put it on my other computers). Then go to the Menus icon in the top right corner -> Tools -> Extensions. You will see a button at the top “Load unpacked extensions…” – click that and navigate to the extracted folder and hit Ok. Open a new tab and try it out.

You can use this base template to use it for any other web applications, but remember they are only localized to your computer. If you have a desktop, laptop, and a workstation, you’ll have to manually add it on each computer. Included is a .psd file if you’d like to make your own Chrome Web Store icons! :3

Bonus DLC: Here is a link to the Facebook one I designed. This one looks a lot better than the crappy one currently available in the Chrome Web Store.

How To Scrape Google Cache With A Python Script

I was curious as to how one could scrape Googles Cache to recover a website that was recently taken down. Say for instance, you’re a real estate agent and your website was terminated by your previous hosting company.

Guy Rutenberg wrote a great script in his blog post titled, “Retrieving Google’s Cache for a Whole Website” back in 2008, and has since been revised by curious Python programmers.

The latest revision was done by Thang Pham, available at: https://gist.github.com/3787790 Let’s look over the code real quick.

I fired up an Amazon EC2 instance and placed the python script in ~/python – and allowed the script to run for about an hour. Again, I am not sure if Amazon or Google will rage but eventually Google will block the ip and you’ll get a 503 error. Keep an eye on this so you don’t get it raging. You can always run the script later after the ip block is removed and it will resume where you left off.

TL;DR: On line 19, change the search_site to your target site. Then go to line 48 and change ‘\’ to the destination directory, I used ‘/’

[py]#Retrive old website from Google Cache. Optimized with sleep time, and avoid 504 error (Google block Ip send many request).
#Programmer: Kien Nguyen – QTPros http://qtpros.info/kiennguyen
#change search_site and search_term to match your requirement
#Original: http://www.guyrutenberg.com/2008/10/02/retrieving-googles-cache-for-a-whole-website/

#!/usr/bin/python
import urllib, urllib2
import re
import socket
import os, errno, os.path
import time
import random, math
#import MySQLdb
import imp;

socket.setdefaulttimeout(30)
#adjust the site here
search_site="qtpros.info"
search_term="site:" + search_site

#mysql = imp.load_source("MySQLConnector", "mysql.py").MySQLConnector()
#mysql.connect(‘localhost’,’root’,”,’webscrape’,True)

def mkdir_p(path):
try:
os.makedirs(path)
except OSError as exc: # Python >2.5
if exc.errno == errno.EEXIST:
pass
else: raise

def main():
headers = {‘User-Agent’: ‘Mozilla/5.0 (X11; U; Linux i686 (x86_64); en-US; rv:1.8.1.4) Gecko/20070515 Firefox/2.0.0.4′}
url = "http://www.google.com/search?q="+search_term

regex_cache = re.compile(r'<a href="([^"]*)"[^>]*>Cached</a>’)
regex_next = re.compile(‘<a href="([^"]*)"[^>]*><span[^>]*>[^<]*</span><span[^>]*>Next</span></a>’)
regex_url = re.compile(r’search?q=cache:[dw-]+:([^%]*)’)
# regex_title = re.compile(‘<title>([wW]+)</title>’)
# regex_time = re.compile(‘page as it appeared on ([dws:]+)’)
regex_pagenum = re.compile(‘<a href="([^"]*)"[^>]*><span[^>]*>[^<]*</span>([d]+)’)

#this is the directory we will save files to
mkdir_p(search_site)
path = os.path.dirname(os.path.abspath(__file__)) + ‘\’ + search_site
# path = os.path.dirname(os.path.abspath(__file__))
counter = 0
pagenum = int(math.floor(len([name for name in os.listdir(path)]) / 10) + 1)
max_goto = 0;
more = True
if (pagenum > 1):
while (max_goto < pagenum):
req = urllib2.Request(url, None, headers)
page = urllib2.urlopen(req).read()
goto = regex_pagenum.findall(page)
# print goto
for goto_url, goto_pagenum in goto:
goto_pagenum = int(goto_pagenum)
if (goto_pagenum == pagenum):
url = "http://www.google.com" + goto_url.replace(‘&amp;’, ‘&’)
max_goto = pagenum
break
elif (goto_pagenum < pagenum and max_goto < goto_pagenum):
max_goto = goto_pagenum
url = "http://www.google.com" + goto_url.replace(‘&amp;’, ‘&’)
random_interval = random.randrange(5, 20, 1)
print "sleeping for: " + str(random_interval) + " seconds"
print "going to page: " + str(max_goto)
print url
time.sleep(random_interval)

while(more):
#Send search request to google with pre-defined headers
req = urllib2.Request(url, None, headers)
#open the response page
page = urllib2.urlopen(req).read()
#find all cache in the page
matches = regex_cache.findall(page)
#loop through the matches
for match in matches:
counter+=1
#find the url of the page cached by google
the_url = regex_url.findall(match)
the_url = the_url[0]
the_url = the_url.replace(‘http://’, ”)
the_url = the_url.strip(‘/’)
the_url = the_url.replace(‘/’, ‘-‘)
#if href doesn’t start with http insert http before
if not match.startswith("http"):
match = "http:" + match
if (not the_url.endswith(‘html’)):
the_url = the_url + ".html"
#if filename "$url"[.html] does not exists
if not os.path.exists(search_site + "/" + the_url):
tmp_req = urllib2.Request(match.replace(‘&amp;’, ‘&’), None, headers)
try:
tmp_page = urllib2.urlopen(tmp_req).read()
f = open(search_site + "/" + the_url, ‘w’)
f.write(tmp_page)
f.close()
print counter, ": " + the_url
#comment out the code below if you expect to crawl less than 50 pages
random_interval = random.randrange(15, 20, 1)
print "sleeping for: " + str(random_interval) + " seconds"
time.sleep(random_interval)
except urllib2.HTTPError, e:
print ‘Error code: ‘, e.code
pass
#now check if there is more pages
match = regex_next.search(page)
if match == None:
more = False
else:
url = "http://www.google.com"+match.group(1).replace(‘&amp;’, ‘&’)

if __name__=="__main__":
main()[/py]

Thanks Guy Rutenberg and Thang Pham for this great python script! You’re both a life saver!

Unified Remote – Androids Answer To Wireless PC Remote!

One of the main reasons I need a wireless PC remote is Netflix and Hulu Plus… I do not own a Television, and if I have a “movie date night” it’s kind of odd to have my guest sit as I awkwardly fumble a keyboard and wireless mouse in the dark.

A few nights ago while I was laying their with my girlfriend, we were coming up to the end of an episode of Sekirai. I couldn’t find my wireless mouse and decided to Google around for a solution.

I ended up finding a god sent savior, Philip from Unified Remote to the rescue!

I quickly downloaded the app and installed the server side client to my PC all while Sekirai continued to play on Netflix. Without a hesitation, Kayla asked, “What are you doing babe?”

Why Is Unified Remote The Best?

I have tried many different types of remotes. Let’s break it down: Xbox 360 Wireless Controller + Wireless PC Dongle, Windows Media Center PC Remote Control, Logitech Wireless G700, TeamViewer for Android, and I’m NOT about to pay $40 for Logmein for Android! To put it simple: Unified Remote has a built in mouse touch pad, utilizes the Android keyboard for input, has specialized remotes for Netflix, Hulu Plus, Pandora, Windows Media Player, VLC, foobar2000, iTunes, and much much more.

TL:DR; Unified Remote has a mouse pad, keyboard, Netflix, Hulu Plus, VLC, iTunes remote.

Inspiration: WordPress Multisite Running On Amazon Web Services

I honestly don’t know why, but I have always feared the day that I would dive head first into Amazon Web Services. In the last two weeks, I have been researching the in’s and out’s of AWS, how people are using it to deploy applications, security, it’s architecture and reading AWS terminology… It is very overwhelming, but I think it’s time I embarked on this adventure.

A few inspirations, Earmilk.com’s Blake Shoji. Although I have never met IRL, nor interacted with him online; the Earmilk network boggles my mind. They definitely sparked my curiosity! If your a music lover, I’d recommend checking them out!

While I was reading up on AWS, I happen to find David Jensen’s blog post on how to install WordPress on Amazon AWS EC2. I am going to use this documentation as a basis for my study, although I do want to branch off to NGINX. We’ll see where the path takes me!

If you need further inspiration that will help motivate you to jump into the cloud, I highly recommend watching “The Known Universe” with The XX Intro Extended dubbed over it. Seriously, the possibilities are endless!

How To Fix AT&T Galaxy S2 Wifi Issue After Root 2.3.6

If you’re a fan of The Unlockr and happen to pick up the AT&T Galaxy S2 (SGH-i777)… You may have flipped upside down and started dragging your head on the keyboard in frustration after you realized your wifi is completely broken! I have the solution.

Fluff: After digging around the XDA and Android Device Forums I found that factory AT&T Galaxy S2 typically came with 2.3.4, most write-ups online is for 2.3.4. Samsung’s recent OTW release 2.3.6, left thousands of Superusers with wifi connectivity issues due to having the wrong kernel.

How To Fix AT&T Galaxy S2 Wifi Issue Under 2.3.6

1.) Calm the fuck down, sip your coffee, breath.
2.) Goto: http://forum.xda-developers.com/showthread.php?t=1289460
3.) Download the latest Attached File (as of 2/12/2012 it is DD_02072012.zip note the retarded naming convention is a time stamp for DD_[02/07/2012].zip – I thought the top attached file was the latest)
4.) Connect Galaxy S2 to your PC/Mac, enter USB Storage Mode, place the .zip file onto your device (just put it in the root).
5.) Power off device and enter ClockworkMod Recovery Mode (By holding down the volume down, volume up button, and the power button. Let go of the power button once the device turns on and continue to hold the volume buttons until the recovery screen loads.)
6.) Use vol up / down to highlight “install zip from sd” then use the home button to select (maybe different on other devices)
7.) Select the .zip file, install, reboot device.

When the OS loads you should be able to go to Settings -> Wifi and see all your hotspots. Connect and test.

image

Note: Please let me know if this does not work for you in the comments. I can further assist / update for others. Thanks!

UPDATE AS OF 6/26/2012: As of June 26, 2012 Samsung has released the OEM Ice Cream Sandwich. Previously, I decided to try out the leaked version that surfaced on the XDA forums. I am currently working on trying out the Samsung official release of ICS. I advise precaution, PROCEED AT YOUR OWN RISK.

UPDATE AS OF 12/1/2013: My AT&T Samsung Galaxy S2 has died as of 11/29/2013… The power button seems to have failed, causing to randomly turn on and off or stick (making it so I cannot wake / lock the screen.) I am very distraught! 🙁 If you by chance found this post, I hope this works for your phone. If you run into issues I can do my best to help. But if you run into an issue and figure out a way around it feel free to leave feedback for future reference. Ironically, I was able to pick up a free Samsung Galaxy S4 on Black Friday. Time to void the warranty! RIP S2, if I find another one on CL cheap I’ll turn it into a dedicated car mp3 player. 🙂

Dark Wood Themes for Google Chrome

I came across a random theme called MonoChrome by Berlinski the other day. Within 24 hours I change the theme to look at other ones and completely forgot what the theme was called.

After about 20 minutes of digging through the theme directory, I had given up hope and went with a colored wood theme (yuck). I eventually got frustrated and started trying to rack my brain for the right Google keywords. Eventually I recalled “Berlinski” as the theme creator and found these results.

Download Monochrome Google Chrome Theme

Other Alternatives I’ve found.

Pine.Chrome
Pine.Chrome2

Hope you enjoy these!

Battlefield 3 Server Admin Hardcore Mode Settings

Below is what you need to set your BF3 server to for hardcore mode. Please reference the BF3 Server Admin Documentation for further information.

[bash]vars.autoBalance true
vars.friendlyFire true
vars.regenerateHealth false
vars.killCam false
vars.miniMap true
vars.hud false
vars.3dSpotting false
vars.miniMapSpotting true
vars.nameTag false
vars.3pCam false
vars.vehicleSpawnAllowed true
vars.soldierHealth 60
vars.onlySquadLeaderSpawn true[/bash]

Kernel.org Down – Installing Git On CentOS

This week I had a SSD tank and I was forced to install a fresh OS. While setting up my workstation, I decided to test VM VirtualBox > VMWare. While I was setting up my VM, I couldn’t grab wget http://kernel.org/pub/software/scm/git/<latest>.tar.gz

I wasn’t sure what was going on so I pinged kernel.org, no packets returned. I was completely unaware that kernel.org DNS’s got hacked. Linus released Linux 3.1 on Github and I needed to get git up fast.

Installing Git On CentOS 5.5

Quickly, I checked the  Webtatic repo for git. Add the repo with this line:

[code lang=”bash”]rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm[/code]

Next you can install git with one line:

[code lang=”bash”]yum install –enablerepo=webtatic git-all[/code]

Installing Gitolite For Private Repo

Below is the quick install guide for gitolite – for all you that want a private repo. I’m currently installing this on a VM just to test it out. Eventually I will move my repo into a datacenter. For now, I just want a private repo so I can seamlessly push / pull between my desktop and laptop while having redundant backups of my projects.

—————————————

If you’re comfortable with Unix and ssh, the following steps should work. (However, gitolite has lots and lots of useful features; don’t miss out on them by skipping the excellent documentation!)

  • create a user called git. Login to this user.
  • copy your ssh pubkey from your workstation. Rename it to YourName.pub.
  • now run these commands:

[code lang=”bash”]
git clone git://github.com/sitaramc/gitolite
cd gitolite
src/gl-system-install
gl-setup ~/YourName.pub[/code]

You’re done. Now run git clone git@server:gitolite-admin on your workstation and add users and repos.

—————————————

Head over to https://github.com/sitaramc/gitolite if your looking for further documentation on gitolit. I’m assuming this will be the best for a private git repo. I will update this post with more information once I have my workstation / laptop setup. Come to think of it, I bet I could write a great post about developing between work,  home, and mobile.