Skip to content

Instantly share code, notes, and snippets.

View aditya95sriram's full-sized avatar

Aditya Sriram aditya95sriram

View GitHub Profile
@aditya95sriram
aditya95sriram / ims_grader.js
Last active August 14, 2016 08:29
IMS Grader (v5.3)
function sep() {console.log("");} // separator for console output
/* Obsolete function, retained for explanatory purposes */
function check(a, b, c) { // checks if any two of a,b or c is true
return ( (a||b) && (b||c) && (a||c) );
}
/* individual row scraper, gather all information about a course and return as object */
function indi(t) {
t = $(t);
@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.
#
#------------------------------------------------------------------------------
#
@aditya95sriram
aditya95sriram / demo-script.py
Last active October 3, 2018 21:21
Sample usage of cubetools.py
import cubetools
# https://gist.github.com/aditya95sriram/8d1fccbb91dae93c4edf31cd6a22510f
# read_cube function reads in cube file as (numpy array, metadata) tuple
data, meta = cubetools.read_cube('demo.cube')
# volumetric data
print data.shape
# (8L, 8L, 8L)
@aditya95sriram
aditya95sriram / barrington.py
Created October 30, 2018 21:53
Implementation of Barrington's theorem. Convert's circuit to a group program and then runs it to show the truth table according to the group program
# Author: P. R. Vaidyanathan
# Examples at the end of document
class Permutation(list):
"""
Represents a permutation and supports inverse, composition,
multiplication using * operator, action on set (through calling),
cycle decomposition and cycle to cycle conversion
"""
@aditya95sriram
aditya95sriram / summary.js
Created March 29, 2019 17:47
Optil Summary Bookmarklet
window.error_regex = /(\w*):.*\s*<\/pre>/igm;
function init() {
var a = $('.content:first .row:first').clone();
a.find('.alert').replaceWith("<h4>Summary <span id='rownumspan'></span></h4><pre id='hack'></pre>");
$('.content:last').append(a);
a = $('.content:first .row:first').clone();
a.empty();
a.append("<div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'><h4>Errors</h4><pre id='errlog'></pre></div><div class='col-xs-6 col-sm-6 col-md-6 col-lg-6'><h4>Error Summary</h4><pre id='errsum' style='white-space: pre-wrap;'>No runtime errors</pre></div>");
$('.content:last').append(a);
@aditya95sriram
aditya95sriram / gre-trainer.js
Created July 29, 2019 14:33
GRE Trainer 2.2
/* GRE Trainer 2.2
* Bookmarklet to help with GRE Vocab
*
* Grab the bookmarklet from https://bookmarkify.it/15582
*
* Instructions:
* 1. Go to https://www.memrise.com/course/1150347/magoosh-gre-vocabulary-in-20-levelsfull-sound/1/
* 2. Click bookmarklet
* 3. Select the decks you want to practice and click "Load Selected Decks"
* 4. Use `tab/shift+tab` to navigate through the words