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
@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"
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
@smhr
smhr / rocks_roll_server_apache_config.md
Last active April 18, 2022 12:23
rocks roll server apache config

At the very beginning of installation of rocks-7.0, we must define a roll server. It's recommended to set up a local server to facilitate roll addition. There are some scripts to make this easy for non experts here. After doing steps 0, I and II, change your site configuration file (e.g /etc/apache2/sites-enabled/000-default.conf in ubuntu or mint) to be like this:

## Definitions for rocks-7-0.my.org (change according to your one)
###
<VirtualHost *:80>
ServerName rocks-7-0.my.org
</VirtualHost>

# allow all access to the rolls RPMS
@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"
@smhr
smhr / different_method_plot.ipynb
Created May 27, 2019 18:03
different_method_plot
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
solarm
pc
450000
0.1000
1.500
2.000
0.4000
30.00
37
3.477