Skip to content

Instantly share code, notes, and snippets.

View v1j4y's full-sized avatar
👋

Vijay v1j4y

👋
View GitHub Profile
@v1j4y
v1j4y / rsync.sh
Created October 18, 2021 05:47
Rsync
alias rsync="rsync -h -v -r -P -t"
@v1j4y
v1j4y / tmux_local_install.sh
Last active December 23, 2016 10:36 — forked from ryin/tmux_local_install.sh
bash script for installing tmux without root access
#!/bin/bash
# Script for installing tmux on systems where you don't have root access.
# tmux will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
TMUX_VERSION=2.3
@v1j4y
v1j4y / debug2.sh
Last active December 21, 2016 12:00
Debugging PETSc using lldb
mpirun -n 2 /opt/X11/bin/xterm -hold -e lldb -o run -ex ex1 -- inpfile
@v1j4y
v1j4y / debug.sh
Created December 20, 2016 11:43
Debugging PETSc using Valgrind
mpiexec -n 4 valgrind --tool=memcheck -q --num-callers=20 --track-origins=yes --log-file=valgrind.log.%p --dsymutil=yes ./ex1 -malloc off inpfile
@v1j4y
v1j4y / compiling_block.txt
Last active March 11, 2016 23:40
build block
1. open-mpi
I. use --with-tm=no
II. export CXX,CC,GCC with the correct gcc path
2. boost
I. give the correct path for CXX,MPICXX
II. using mpi in the project-*.jam file
III. use ldd to verify that the correct libraries are being used
IV. otherwise change LD_LIBRARY_PATH to point to the correct libraries
V. one must also use this to invoke b2: ./b2 install --user-config=user-config.jam --with-filesystem --with-system -j4 --with-mpi --with-program_options --with-serialization stage
3. Block
@v1j4y
v1j4y / diag.py
Last active November 16, 2015 16:56
Gets the Heisenberg hamiltonian and calculates the S^2 value for each vector in a given m_s subspace
#!/usr/bin/env python
import numpy
from numpy import linalg as LA
print "numpy version=",numpy.version.version
# set up the Heisenberg hamiltonian for interaction between two spins S=5/2 and S=3/2 spins
array = numpy.zeros((4,4))
@v1j4y
v1j4y / getfloat.awk
Last active September 21, 2015 08:43
Awk one liner to seperate floating point data from other data
awk '/[0-9]+\.[0-9]*/ { print }'
@v1j4y
v1j4y / gitview
Last active July 27, 2021 11:39
Command line plot of insertions and deletions in a git repo
#!/bin/bash
#git log --stat --decorate --oneline | awk '$5 ~"insertions" {COUNT++;print COUNT,$4,$4-$6} $2 ~ "origin" {print $2; }' >/tmp/additions
git log --stat --decorate --oneline | awk '$5 ~"insertions" {COUNT++;print COUNT,$4,$4-$6}' >/tmp/additions
gnuplot<<EOF
set terminal dumb
set multiplot
plot 'additions' u 1:2 with lines lt 1
exit
EOF
@v1j4y
v1j4y / huckelmatrix.m
Last active August 29, 2015 14:19
generates the huckel matrix of arbitrary rank using cyclic graphs
hu[n_]:=t*(AdjacencyMatrix@CycleGraph[n]-SparseArray[{{1,n}->1,{n,1}->1}]);
hu[5]//MatrixForm
@v1j4y
v1j4y / crop_mat.m
Last active August 29, 2015 14:18
Crop zeroes from a matrix
Nest[Transpose@DeleteCases[#, {(0 | 0.) ..}] &, m, 2]
(*
Remove 0 and 0. columns and rows from a given matrix and reduce the size to contain only non-zero rows and columns
*)