Skip to content

Instantly share code, notes, and snippets.

View kastnerp's full-sized avatar
🍋
Focusing

Patrick Kastner kastnerp

🍋
Focusing
View GitHub Profile
@kastnerp
kastnerp / residuals.py
Last active February 27, 2022 19:44
Plotting OpenFOAM residuals with Python
# https://bit.ly/plot-openfoam-residuals
import pandas as pd
import matplotlib.pyplot as plt
data = pd.read_csv("residuals.dat",skiprows=1, delimiter='\s+').iloc[:, 1:].shift(+1,axis=1).drop(["Time"], axis= 1)
plot = data.plot(logy= True, figsize=(15,5))
fig = plot.get_figure()
ax = plt.gca()
ax.legend(loc='upper right')
ax.set_xlabel("Iterations")
@kastnerp
kastnerp / .htaccess
Created August 4, 2019 14:15 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@kastnerp
kastnerp / .htaccess
Created August 4, 2019 14:15 — forked from ScottPhillips/.htaccess
Common .htaccess Redirects
#301 Redirects for .htaccess
#Redirect a single page:
Redirect 301 /pagename.php http://www.domain.com/pagename.html
#Redirect an entire site:
Redirect 301 / http://www.domain.com/
#Redirect an entire site to a sub folder
Redirect 301 / http://www.domain.com/subfolder/
@kastnerp
kastnerp / gist:c5f079b2f396dd7d7e91a00528d00a58
Created July 6, 2019 13:01
DataTree to List of Lists (works only in scripting component)
public static List<List<T>> ToListOfLists<T>(DataTree<T> tree)
{
List<List<T>> list = new List<List<T>>();
foreach (List<T> b in tree.Branches)
{
list.Add(b);
}
return list;
}