find . -name .DS_Store -printf \"%p\"\ \ | xargs rm
15 1 * * * root find / -name ".DS_Store" -depth -exec rm {} \;
Wikipedia’s Thank-you note received after donation.
I got this thank-you email for donating to Wikipedia today. I usually don’t read emails this long, but this email was compelling enough.. Wikipedia has truly helped me a lot in my learning, glad its there!
Dear Prakhar,
Thank you for donating to the Wikimedia Foundation. You are wonderful!
It’s easy to ignore our fundraising banners, and I’m really glad you didn’t. This is how Wikipedia pays its bills — people like you giving us money, so we can keep the site freely available for everyone around the world.
People tell me they donate to Wikipedia because they find it useful, and they trust it because even though it’s not perfect, they know it’s written for them. Wikipedia isn’t meant to advance somebody’s PR agenda or push a particular ideology, or to persuade you to believe something that’s not true. We aim to tell the truth, and we can do that because of you. The fact that you fund the site keeps us independent and able to deliver what you need and want from Wikipedia. Exactly as it should be.
You should know: your donation isn’t just covering your own costs. The average donor is paying for his or her own use of Wikipedia, plus the costs of hundreds of other people. Your donation keeps Wikipedia available for an ambitious kid in Bangalore who’s teaching herself computer programming. A middle-aged homemaker in Vienna who’s just been diagnosed with Parkinson’s disease. A novelist researching 1850s Britain. A 10-year-old in San Salvador who’s just discovered Carl Sagan.
On behalf of those people, and the half-billion other readers of Wikipedia and its sister sites and projects, I thank you for joining us in our effort to make the sum of all human knowledge available for everyone. Your donation makes the world a better place. Thank you.
Most people don’t know Wikipedia’s run by a non-profit. Please consider sharing this e-mail with a few of your friends to encourage them to donate too. And if you’re interested, you should try adding some new information to Wikipedia. If you see a typo or other small mistake, please fix it, and if you find something missing, please add it. There are resources that can help you get started. Don’t worry about making a mistake: that’s normal when people first start editing and if it happens, other Wikipedians will be happy to fix it for you.
I appreciate your trust in us, and I promise you we’ll use your money well.
Thanks,
SueSue Gardner
Executive Director,
Wikimedia Foundation
https://donate.wikimedia.org
Common git commands to use
Here are a common git commands that I end up using pretty frequently. Will keep on updating this list
- List all remote branches
- Just view modified files between 2 branches (without diff)
git remote -v
Displays url of remote repo from where local git was pulled- Viewing Unpushed Git Commits
Simplest is git branch -a
Shows all remote and local branches. git branch -r
Will show all remote branches only.
Another way is to use git remote feature like:
git remote show origin
This shows all branches on remote and how they corelate with local repo.
git ls-remote
Will meticulously list all branches and tags.
git diff --name-status master..branch
Will list out only filenames git diff master..branch
without –name-status will show whole diff.
Alternatively use git remote show origin
or git config --get remote.origin.url
git log origin/master..HEAD
To view diffs: git diff origin/master..HEAD
Another way: git log @{u}..
Timesjobs.com sell your email address and phone numbers to spammers
Online job search portals are flourishing in India. However it turns out that some job portals have totally sold their conscience and pay no respect to user’s privacy and trust. One such lame job portal is timesjobs.com. The retards in this company carelessly sell user’s email and phone to nuisance creating spammers, breaching all privacy policy clauses as laid down on their own website. These nasty spammers, in turn send useless crap about lottery, and hoax job offers.
To expose their scandal, I registered on timesjobs.com via a separate email id specially made for timesjobs. Soon I started receiving spam messages. When I analysed headers in the original email, it officially proved that messages were sent to timesjobs id.
I have sent an email to their corporate office as well.
To: corporatecare@timesgroup.com
Hi,
I recently realized that timesjobs is illegally selling private information like phone numbers and email addresses to spammers and marketeers. I have attached a snapshot which proves this. It is a clear breach of the privacy policy as mentioned here: http://www.timesjobs.com/popuphtml/privacy.html.
Let me know what explanation you have for this.
-Prakhar
I am trying to find a legal aspect to sue these guys. If anyone is aware of this process, kindly let me know. In the meantime, request you to tweet and digg this post so that timesjobs can learn some lesson.
Bank Loan EMI and recurring deposit interest calculator
Just yesterday, I was signing up for a LIC Jeevan Saral plan. I needed to perform some quick calculation to select the best recurring deposit (RD), based on ROI. I tried searching for some good online utility which can serve the purpose. To my surprise, out of several available online calculators, there was not a single one which was presentable enough. None of them provide breakup details etc. I decided to create one myself and make it publicly available so that others can use it as well.
Features:
- Cleaner user interface. No clutter.
- Provides accurate calculations and 2 decimal precision.
- Time (in years or months) can be in fractions.
- Rate of interest can be above 100.
- Printer friendly print option.
Loan EMI calculator: https://prakhargoel.com/projects/calculators/emi_calculator.php
Annual Recurring Deposit Calculator: https://prakhargoel.com/projects/calculators/annual_recurring.php
Monthly Recurring Deposit Calculator: https://prakhargoel.com/projects/calculators/monthly_recurring.php
Handy commands in Mac/Linux systems
Here’s a list of common commands I use in Linux. I will continue to update this list with more stuff.
- Checking fireball logs:
screen
command: Use it to create parallel sessions in terminal. Useful for running long processes on remote servers even after signing out of server.Usage:
[code lang=”bash”]
screen
# This creates a separate screen.screen -ls
#lists all attached/detached screens IDsscreen -x 13152
# Enter (Attach) screen ID 13152 (just an example, can be any ID number)echo $STY
# Displays current screen ID you are working in.
[/code]
Ctrl-a d
Detach from current screen.dpkg --get-selections
List all installed packages. (Only on debian systems like Ubuntu which support apt-get)
Smartly grep to find package you are looking for eg-dpkg --get-selections | grep mysql
[code lang=”bash” gutter=”false”]
cat /var/log/appfirewall.log
# You will see stuff like
Jun 21 10:37:51 prakhars-MacBook-Pro Firewall[90]: postgres is listening from 0.0.0.0:5432 proto=6
Jun 21 10:38:11 prakhars-MacBook-Pro Firewall[90]: mysqld is listening from ::ffff:0.0.0.0:3306 proto=6
Jun 21 10:40:21 prakhars-MacBook-Pro Firewall[90]: Dropbox is listening from 0.0.0.0:17500 proto=6
Jun 21 10:40:21 prakhars-MacBook-Pro Firewall[90]: java is listening from ::ffff:0.0.0.0:0 proto=6
Jun 21 10:44:38 prakhars-MacBook-Pro Firewall[90]: GoogleTalkPlugin is listening from 127.0.0.1:49198 proto=6
Jun 21 10:45:35 prakhars-MacBook-Pro Firewall[90]: python is listening from 127.0.0.1:8000 proto=6
[/code]
Using Django using VirtualEnv on MAC. Fast forward installation.
This is a fast forward tutorial which will guide you through django installation on virtualenv. Detailed installation instructions using source codes can be found on respective package’s official site.
Pre- Requirements:
Make sure you have easy_install
on MAC
Install pip using easy_install pip
1) Installing Virtualenv: Run following lines in terminal:
[code lang=”bash” gutter=”false”]
pip install virtualenv
pip install virtualenvwrapper
# Use a text editor to edit .profile and Insert following lines. Eg using vim:
# $ vim .profile
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Devel
source /usr/local/bin/virtualenvwrapper.sh
# Now open a new terminal window and Type:
mkvirtualenv myfirstproject
# You will see something like:
(myfirstproject) $
# This means you are now working isolatedly in myfirstproject
# The location of this project is ~/.virtualenvs/myfirstproject
[/code]
2) Installing Django and South:
[code lang=”bash” gutter=”false”]
# [info] Make sure you are inside myfirstproject:
# $ workon myfirstproject
# Now run in terminal:
pip install Django
pip install south
# This installs Django in: .virtualenvs/myfirstproject/lib/python2.6/site-packages/django/
[/code]
3) Starting first django project:
- [info] Type
workon myfirstproject
if you are not already in your virtual environment. - [info] you can directly go to your site packages dir by typing
cdsitepackages
- [info] can check the location of django-admin by
which django-admin.py
- Initiating django project now. Assuming you are at .virtualenvs/myfirstproject/ Type:
django-admin.py startproject mydjangoproject
- This will start your first django project.
- Now start server by
python manage.py runserver
Default port is 8000. If you have to change port, just write port number after runserver- Now, Visit browser at localhost:8000
- Congrats, we have just installed a basic django app.
Display file permissions as octal number in ls command
Normally, in *nix systems like Linux, mac the file permissions are displayed as symbolic notations. So when doing a ls -l
in a directory you’ll see drwxr-xr-x+
like symbolic permissions next to a directory. This is equivalent to 755 in octal permissions. I find octal permissions easier to grasp and understand. Unfortunately, there is no native switch in ls to show octal permissions. So here is a little custom command that will do the needful.
[code lang=”bash”]
ls -l | awk ‘{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf("%0o ",k);print}’
[/code]
This command will show octal file permissions before its symbolic representation.
If you find it impressive and would like to bookmark it, just add this line in your ~/.profile or ~/.bash_profile (depending on mac or linux) using your favorite editor (I’d use vim).
[code lang=”bash”]
alias l= "ls -la | awk ‘{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\" %0o \",k);print}’"
[/code]
We have just escaped $
and "
with a \
in above line.
Some under-the-hood details: This command works by piping the output of ls -l
to awk as its input. awk is a pattern directed scanning and processing language. For more info you can do man awk
which shows:
Awk scans each input file for lines that match any of a set of patterns specified literally in prog or in one or more files specified as -f progfile. With
each pattern there can be an associated action that will be performed when a line of a file matches the pattern. Each line is matched against the pattern
portion of every pattern-action statement; the associated action is performed for each matched pattern. The file name – means the standard input. Any file
of the form var=value is treated as an assignment, not a filename, and is executed at the time it would have been opened if it were a filename. The option
-v followed by var=value is an assignment to be done before prog is executed; any number of -v options may be present. The -F fs option defines the input
field separator to be the regular expression fs.An input line is normally made up of fields separated by white space, or by regular expression FS. The fields are denoted $1, $2, …, while $0 refers to
the entire line. If FS is null, the input line is split into one field per character.A pattern-action statement has the form
pattern { action }
A missing { action } means print the line; a missing pattern always matches. Pattern-action statements are separated by newlines or semicolons.
MAC View file transfer speeds while copying
Often while copying large files from external hard disks, you want to see the transfer rates. MAC natively doesn’t show the transfer speed. However there’s a workaround:
1) open Terminal and write:
[code lang=”bash” light=”true”]
while true ; do iostat -w 2 ; done
[/code]
This will show real-time data transfer speed of all mounted disks. Like:
[code lang=”bash” light=”true”]
$ while true ; do iostat -w 2 ; done
disk0 disk1 cpu load average
KB/t tps MB/s KB/t tps MB/s us sy id 1m 5m 15m
71.23 134 9.35 44.69 45 1.96 21 22 58 1.61 1.94 1.90
70.61 237 16.33 66.18 169 10.95 8 30 63 1.48 1.91 1.88
77.30 109 8.22 16.09 605 9.50 8 33 59 1.48 1.91 1.88
385.81 20 7.53 21.54 449 9.44 8 28 64 1.44 1.89 1.88
243.28 17 4.04 14.09 319 4.39 7 26 67 1.44 1.89 1.88
[/code]
Interesting Python questions
See if you are able to answer these python questions:
[code lang=”python”]
lams = []
for i in range(10):
lams.append(lambda:i)
print [f() for f in lams]
[/code]