Skip to content

Instantly share code, notes, and snippets.

@vaibhaw
vaibhaw / install_tools.sh
Last active December 14, 2015 21:27
Installation Tools
## dynamic links to .so files
ldd libopenblas.so
## install gxx-4.8 and/or gxx-4.9 on Ubuntu 12.04 or Ubuntu 14.04
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 50
sudo apt-get install g++-4.9
@vaibhaw
vaibhaw / sys_tools.sh
Last active December 7, 2015 11:32
Admin Tools
## System Monitoring Tools
# TODO - provide more useful flags
top
free -m
vmstat
iostat
iotop
sar
netstat
@vaibhaw
vaibhaw / git-tips.sh
Last active November 28, 2016 11:21
Common git commands
## check url of git-repo
git remote -v
## change url of git-repo
git remote set-url origin <new-git-repo-url>
## colorize git output
# source: http://unix.stackexchange.com/a/44297/62741
# source: http://stackoverflow.com/a/13075208/925216
git config --global color.ui auto
## If 2FA is set in github, you have to generate an access token
@vaibhaw
vaibhaw / sed-awk.sh
Created May 6, 2015 22:21
Text processing scripts
http://unix.stackexchange.com/questions/112023/how-can-i-replace-a-string-in-a-files
package com.test.lucene;
import java.io.File;
import java.io.IOException;
import java.io.StringReader;
import java.util.Calendar;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
@vaibhaw
vaibhaw / linux_tools.sh
Last active March 6, 2025 19:26
Linux Utils
## debian package manager tips
# source: http://askubuntu.com/a/17829/258167
# source: http://askubuntu.com/a/423556/258167
# To check whether a package is installed or not:
dpkg -l
dpkg -l libprotobuf # OR
dpkg -l | grep libprotobuf
# Show the location where the package is installed
sudo dpkg -S libprotobuf
@vaibhaw
vaibhaw / grep.sh
Last active August 29, 2015 14:16
Linux Utilities
## recursive search only in specific filetypes
grep -nr --include=<pattern> <string> <directory>
# grep -nr -i --include *.{cpp,hpp,java} "isequal" .
# grep -nr -i --include *.cpp --include *.hpp "isequal" .
## grep seach exact word
grep -r -i /^word$/ .
-- To login into mysql through command line similar to connecting ssh hosts
-- write following options in your ~/.my.cnf file
-- Ref # http://dba.stackexchange.com/q/3889
[clientremote]
host=db_host_ip
user=db_username
password=db_password
database=db_schema
[clientlocal]