Skip to content

Instantly share code, notes, and snippets.

View aditya95sriram's full-sized avatar

Aditya Sriram aditya95sriram

View GitHub Profile
0 = Success
1 = Operation not permitted
2 = No such file or directory
3 = No such process
4 = Interrupted system call
5 = Input/output error
6 = No such device or address
7 = Argument list too long
8 = Exec format error
@jiggzson
jiggzson / scientificToDecimal.js
Last active December 25, 2022 21:03
Converts a javascript number from scientific notation to a decimal string
var scientificToDecimal = function (num) {
var nsign = Math.sign(num);
//remove the sign
num = Math.abs(num);
//if the number is in scientific notation remove it
if (/\d+\.?\d*e[\+\-]*\d+/i.test(num)) {
var zero = '0',
parts = String(num).toLowerCase().split('e'), //split into coeff and exponent
e = parts.pop(), //store the exponential part
l = Math.abs(e), //get the number of zeros
@yig
yig / Latex space saving tricks
Last active July 8, 2024 06:44
Latex space saving tricks
%% Make everything look better.
%% http://tex.stackexchange.com/questions/553/what-packages-do-people-load-by-default-in-latex
%% http://www.howtotex.com/packages/9-essential-latex-packages-everyone-should-use/
\usepackage{microtype}
%% Shrink space around figures.
%% This beats manually adding negative \vspace commands everywhere.
%\setlength{\textfloatsep}{0pt}
%\setlength{\textfloatsep}{20pt plus 2pt minus 4pt}
%\setlength{\textfloatsep}{10pt plus 2pt minus 4pt}
@aditya95sriram
aditya95sriram / dat2xml.sh
Last active June 23, 2017 15:13
Converts all .dat binary files output by Quantum Espresso to human readable .xml using IOTK
# Script to convert binary data in .dat files to .xml files
# using Quantum Espresso Input Output Toolkit (iotk)
# =========================================================
#
# NOTE: Set IOTK directory on line 24 before using
# e.g. <espresso>/bin/iotk, where <espresso> is the path to Quantum Espresso
#
# Recommended Usage:
# - Place script in home directory (optional)
# - navigate to *.save directory generated by Espresso
@aditya95sriram
aditya95sriram / cubetools.py
Last active December 7, 2023 00:35
Python module to work with Gaussian cube format files
#------------------------------------------------------------------------------
# Module: cubetools
#------------------------------------------------------------------------------
#
# Description:
# Module to work with Gaussian cube format files
# (see http://paulbourke.net/dataformats/cube/)
#
#------------------------------------------------------------------------------
#
@aditya95sriram
aditya95sriram / setlocq.py
Last active June 27, 2017 13:48
Port of Quantum Espresso's setlocq routine
#------------------------------------------------------------------------------
# Function: setlocq
#------------------------------------------------------------------------------
#
# Description:
# Port of Quantum Espresso's 'setlocq' routine (PHonon/PH/setlocq.f90)
#
#------------------------------------------------------------------------------
#
# What does it do:
@aditya95sriram
aditya95sriram / allband.sh
Created June 27, 2017 14:09
Extracts wavefunction for multiple bands using pp.x from Quantum Espresso.
#!/bin/bash
#------------------------------------------------------------------------------
# Shell script: allband.sh
#------------------------------------------------------------------------------
#
# Description:
# Extracts wavefunction for multiple bands using pp.x from Quantum Espresso.
#
#------------------------------------------------------------------------------
#