Skip to content

Instantly share code, notes, and snippets.

@smhr
smhr / Makefile.remark
Last active April 9, 2016 07:23 — forked from sudarkoff/Makefile.pandoc
Makefile for converting Markdown to slides using markdown-to-slide and remark.
## Markdown to slides is a command line interface to convert markdown documents to an HTML slideshow.
## Basically, Markdown to slides uses remark to convert your markdown documents to HTML slideshows, i.e. that can be viewed in your favorite modern Web browser.
BUILD_DIR := build
REMARK := markdown-to-slides
MARKDOWN := $(wildcard *.md)
HTML := $(patsubst %.md,$(BUILD_DIR)/%.html,$(MARKDOWN))
@smhr
smhr / Read_in_a_loop.py
Created March 4, 2017 10:06
Read in a loop
fileList = ['system.dat','system.dat_2.5_0.3','system.dat_2_0.3','system.dat_1.1_0.3',
'system.dat_0.85_0.3','system.dat_0.75_0.3','system.dat_2_0.1']
for fileName in fileList:
sDateFile = 'myFiles/' + fileName ## File name to read
## Read needed data
tMc, Time, Mass, Rh, Rhl, Rt, Ntot, Rc, error = np.loadtxt(
sDateFile, unpack=True, usecols = (8, 1, 2, 16, 17, 20, 45, 13, 6))
@smhr
smhr / reduce_pdf_size.sh
Created April 8, 2018 12:11
Reduce the size of pdf files in the current directory.
mkdir ./big_pdfs
mkdir ./small_pdfs
for F in `ls *.pdf`; do
echo $F
smallPDF="./small_pdfs/$F"
echo $newPDF
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=$smallPDF $F
ffmpeg -framerate 5 -i ./splash_%04d.png -c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" movie_name.mp4
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smhr
smhr / different_method_plot.ipynb
Created May 27, 2019 18:03
different_method_plot
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@smhr
smhr / phantom.sh
Last active July 23, 2019 12:22
Phantom environment variables
#================== Phantom compile =====================
export OMP_SCHEDULE="dynamic"
export OMP_STACKSIZE=512M
ulimit -s unlimited
export SYSTEM=gfortran
#================== Phantom run =========================
export OMP_NUM_THREADS=9
export I_WILL_NOT_PUBLISH_CRAP=yes
modelName="N450M37rho16hac120"
./phantomsetup $modelName < "${modelName}.input"
solarm
pc
450000
0.1000
1.500
2.000
0.4000
30.00
37
3.477
@smhr
smhr / conda.sh
Last active September 12, 2019 01:27
conda
## For installing a package when you installed anaconda for all users
sudo su root -c "/opt/anaconda3/bin/conda install package_name"
##
sudo su root -c "/opt/anaconda3/bin/conda install -c conda-forge package_name"
@smhr
smhr / Change MAX_CPU 8 to 16 in nbody6.sh
Created October 4, 2019 12:11
Change MAX_CPU 8 to 16 in nbody6
grep -rlnI "MAX_CPU 8" . | xargs -l sed -i -e 's/MAX_CPU 8/MAX_CPU 16/g'