Skip to content

Instantly share code, notes, and snippets.

View mtesseracted's full-sized avatar

mtesseracted

  • Duke University
  • USA
View GitHub Profile
# bc config file, define constants and functions
# all units from physics.nist.gov (if available)
## math constants
pi=4.0*a(1.0)
phi=(1.+sqrt(5.))/2.
## physics constants
g=6.6743*(10^-11) # gravitational, (m3 kg-1 s-2)
h=6.62607015*(10^-34) # planck, (J s)
@mtesseracted
mtesseracted / pythonidae.sh
Last active April 9, 2024 18:26
install a specific python version from bash
#!/bin/bash
pyver=3.9
if [ -n "$1" ]; then
pyver="$1"
fi
pyroot=$HOME/opt/pythonidae
pyftp="https://www.python.org/ftp/python"
quitexit(){
@mtesseracted
mtesseracted / xex_frac_deriv.nb
Created February 1, 2022 23:39
fractional derivatives of xe^x
(* found at https://community.wolfram.com/groups/-/m/t/1313893 *)
(* \
modified as per reddit user u/wxehtexw to integrate from -inf instead \
of 0 *)
FractionalD[\[Alpha]_, f_, x_, opts___] :=
Integrate[(x - t)^(-\[Alpha] - 1) (f /. x -> t), {t, -Infinity, x},
opts, GenerateConditions -> False]/Gamma[-\[Alpha]]
FractionalD[\[Alpha]_?Positive, f_, x_, opts___] :=
Module[{m = Ceiling[\[Alpha]]},
If[\[Alpha] \[Element] Integers, D[f, {x, \[Alpha]}],
@mtesseracted
mtesseracted / sym2ce.py
Last active April 24, 2021 16:02
Find chemical symbols and surround them with \ce{ Symbol }
#!/usr/bin/env python3
# Find chemical symbols and surround them with \ce{ Symbol }
# Problem words: I, HOW, In, degrees K. Add words to exlist to ignore them.
# Also find lines of the type: '(a) .*' and surround them with '\wrongchoice{ (a) .*}'
import re, sys
if len(sys.argv) < 2 :
print('Usage:> {} <filename>'.format(sys.argv[0]))
sys.exit(1)
@mtesseracted
mtesseracted / dgesvx_tester.f90
Last active July 28, 2020 13:36
test program for dgesvx
! Test program for dgesvx
! compile command used:
!ifort dgesvx_tester.f90 -L/opt/intel/composer2018/mkl/lib/intel64 -lmkl_core -lmkl_intel_lp64 -lmkl_sequential -lpthread
program main
implicit none
external :: dgemv
external :: dgesv
external :: dgesvx
integer, parameter :: dp = selected_real_kind(15,300)
@mtesseracted
mtesseracted / x1ps1.sh
Last active April 14, 2022 11:25
bash PS1 setting script
# PS1 setting script, features:
# Regular use: (opt1/opt2 means opt1 has precedence)
## user@host|cmd_time/clock|pwd$exit_code/''>
## print in color (if available)
## first print user@host (green):
## host color is bold if SSH session.
## cmd_time (green|yellow|red) || clock (green):
## clock time or cmd_time (if cmd_time > 20s).
# ~/.bashrc: executed by bash(1) for non-login shells.
# ______________________________________________________________________
# / \
# ( Ubuntu defaults )
# \______________________________________________________________________/
#
# If not running interactively, don't do anything
case $- in *i*);; *) return;; esac
@mtesseracted
mtesseracted / timed.f90
Last active August 3, 2018 18:54
timing array unformatted writing
module kinds
save
integer, parameter :: dp = selected_real_kind(15, 307)
end module kinds
program am_timed
use kinds, only : dp
@mtesseracted
mtesseracted / myconfig.sh
Last active July 20, 2018 21:03
Configuration for quantum espresso
#!/bin/bash
THISDIR=$(pwd)
if [ -z "$1" ]; then
mode='s' #serial
else
mode='p' #parallel
fi
@mtesseracted
mtesseracted / gnome-terminal-profiles.adoc
Created March 6, 2018 15:39
Export / Import Gnome Terminal Profiles

Export Gnome Terminal Profile

List profiles

dconf dump /org/gnome/terminal/legacy/profiles:/

Determine the terminal profile string for the profile you will need. This is the terminal profile that I will export: