Posts

Showing posts from 2017

How to print contents of any database file

  1 import sqlite3 as lite   2 import sys   3   4 def print_db_content(database_to_read):   5         conn = lite.connect(database_to_read);   6         cur = conn.cursor()   7         # http://stackoverflow.com/questions/305378/list-of-tables-db-schema-dump-etc-using-the-python-sqlite3-api   8         # Below query is equivalent to typing .tables in sqlite command line   9         query = "SELECT name from sqlite_master where type = 'table'"  10         tables_list = list(cur.execute(query))  11         print tables_list  12         for item in tables_list:  13                 query = "SELECT * from '" + str(item[0]) + "'"  14                 print query  15                 cur = conn.cursor()  16                 data = list(cur.execute(query))  17                 for item1 in data:  18                         print item1  if __name__ == "__main__":          if (len(sys.argv)<0):                  print 'Usage: python

Working effectively with iTerm2

Mar 22, 2012 I have been using iTerm in daily work for almost a year now. Along the way, I learned a few handy settings tweaks and shortcut keys to boost my productivity in command-line environment. Install iTerm2 If you haven’t heard of iTerm , it’s a popular open source alternative to Mac OS X Terminal . Give it a try, download and install it from http://www.iterm2.com . Fine-Tune Settings Launch iTerm, open iTerm > Preferences or just Cmd + , . Open tab/pane with current working directory Under Profiles tab, go to General subtab, set Working Directory to “Reuse previous session’s directory” . Enable Meta key To enable Meta key for Bash readline editing e.g. Alt + b to move to previous word, under Profiles tab, go to Keys subtab, set Left option key acts as: to “+Esc” . Hotkey to toggle iTerm2 Under Keys tab, in Hotkey section, enable “Show/hide iTerm2 with a system-wide hotkey” and input your hotkey combination, e.g. I use C

Macbook Keyboard Tips for Windows users

Image
Original Post - https://www.macworld.co.uk/how-to/mac/keyboard-shortcuts-mac-users-copy-paste-option-shortcuts-3504584/ The three most important keys on your Mac can be found to the left and right of the spacebar (for right and left handed use). Unfortunately these three keys seem to cause more confusion than any others. Using the Option or Alt key on a Mac There is a great deal of confusion over what Apple referrs to as the Option key . If you'are using a UK keyboard chances are this is called the Alt key so it's no wonder most people don't know where it is. The Alt (aka Option) key can be found between Control and Command. It has an icon that looks like a slope and a dip with a line above it. Chances are the first time you hear mention of Option you are following a tutorial and trying to fix something on your Mac. The Alt key is the one you use if you wish to select a boot partition when starting the computer, you also press it when typing certain chara

Useful commands in Linux

View the job launched via process id xargs -0 < /proc/<pid>/cmdline Get the history of commands run from a user. grep - e "$pattern" / home /*/. bash_history How to find the files difference between two directories in linux and also ignoring the extension?   comm -13 <(find dir1 -type f -exec bash -c 'basename "${0%.*}"' {} \;     | sort) <(find dir2 -type f -exec bash -c 'basename "${0%.*}"' {} \;   | sort)   Type the above command in one line. comm -13 - will show the filenames unique to directory 2 comm -12 - will show all filenames common to both directories comm -23 - will show the filenames unique to directory 1. grep -F -x -v -f fileB fileA     Github change author name without edit   git rebase -i HEAD~4 -x "git commit --amend --author 'name <email>' --no-edit"      Command to count the file extension of a particular type. find . -type f | sed -n '

List of Packages to Install for Anaconda

Anaconda - Package manager used to install packages and run python as a user. This means that you can run things on server without sudo priveliges. Steps to installation Download Anaconda Run bash <Anaconda.sh> List of packages to Install are as follows conda install -c groakat lame conda install -c conda-forge -y sox libvorbis conda install -c jjhelmus tensorflow conda install -c conda-forge matplotlib conda install numpy pyyaml mkl setuptools cmake cffi conda install -c conda-forge tqdm conda install -c conda-forge libsvm conda install -c geneko pp conda install pytorch torchvision cuda80 -c soumith

How to use a scheduler - Torque - QSUB

Check the status of your jobs qstat qstat - lists all the jobs on the system. Check status of jobs for a user qstat -u <username> Get all details about a particular job qstat -f <job id> Delete a job from queue qdel <job id> 

Numpy Tricks

How to print/display the number in full in an array? import numpy as np np.set_printoptions(threshold=np.nan)

Resume Tips

  21 Resume Tips That Will Get More Interviews In 2021 Original link - https://www.offtheclockresumes.com/blog/21-resume-tips-for-2021 What’s keeping you from updating your resume? There are few worse scenarios in life than this... You dread going to work every morning. You do it because you need to pay the bills and chip away at that looming debt you’re reminded of with every monthly statement. You get an email or text from an old friend, former co-worker, or industry connection that you made years ago about a job opening with a company you’ve been discreetly stalking online for weeks. All you need to do is send over your resume or apply online tonight, and the job is practically yours. It only takes one look at your resume, and you feel defeated. You haven’t touched it in years. It doesn’t even have your most recent job listed, and it’s overall look and feel hasn’t changed much over time. You’re pretty sure it looks as ineffective as you feel after a long day at work. Resume writing

Firefox 57 aka Firefox Quantum - The best browser so far from Firefox

Image
Wow, I am amazed at the speed of this amazing browser - Firefox Quantum. Firefox Quantum has a concept of loading the CSS engine and other changes which makes the browser a breeze to use with. Firefox Quantum is releasing in November 2017. But why wait - Go ahead and try this browser out here - https://www.mozilla.org/en-US/firefox/channel/desktop/#beta And for all languages the website links is here - https://www.mozilla.org/en-US/firefox/beta/all/ You will certainly consider leaving Google Chrome after trying the browser out!!!! Reference:- http://www.zdnet.com/article/mozilla-firefox-57-is-so-fast-were-calling-it-firefox-quantum/

Install Octave with GUI 4.2.1 in Mac OS - Sierra or High Sierra

Hi everyone, Today, we are going to review how to install Octave 4.2.1 in Mac OS Sierra or High Sierra. Octave installation with GUI using MacPorts is successful. How to Install MacPorts - [Refer steps on official MacPorts page ] - https://www.macports.org/install.php Installation of Octave :- sudo port selfupdate sudo port install octave Use Octave with GUI What didnt work : - I tried installing Octave using HomeBrew and it didnt work with GUI. Normal Octave using command line works. Octave installation which Did not work on GUI :- brew tap homebrew/science brew update && brew upgrade brew install octave I also tried using brew reinstall octave --with-qt --with-fltk --with-gui Which also didnt load using GUI Commands Reference - http://wiki.octave.org/Octave_for_macOS

Sox of Silence - Original post - http://digitalcardboard.com/blog/2009/08/25/the-sox-of-silence/

Image
The SoX of Silence SoX is, by their own definition,  the Swiss Army knife of audio manipulation. And no doubt it’s full of fun with slicing and dicing and playback and recording and filtering and effects capabilities. But SoX is a command line tool, which means obscure syntax and parameters in order to get things done. I’ve been trying off and on for months to try to understand the  silence  filter from within SoX, which allows one to remove silence from the beginning, middle, or end of the audio. Sounds, simple, doesn’t it?  Well, it should be. Below is the  man page for the  silence  filter : silence  [-l] above-periods [duration threshold[d|%] [below-periods duration threshold[d|%]] Removes silence from the beginning, middle, or end of the audio. Silence is anything below a specified threshold. The above-periods value is used to indicate if audio should be trimmed at the beginning of the audio. A value of zero indicates no silence should be trimmed from the beg