This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python3 | |
| # Convert vtkUnstructuredGrid VTK file to Wavefront OBJ file or STL file | |
| import sys | |
| import os | |
| import vtk | |
| if len(sys.argv) != 3: | |
| print('Usage: ', sys.argv[0], 'in.vtk out.obj') | |
| sys.exit() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # clone and build gcc for linux, link bin | |
| gccpath="/home/ronialek/gcc-test" | |
| mkdir $gccpath | |
| cd $gccpath | |
| git clone git://gcc.gnu.org/git/gcc.git . | |
| git checkout releases/gcc-13 | |
| ./contrib/download_prerequisites | |
| mkdir build | |
| cd build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python3 | |
| # Extract last frame from LAMMPS xyz dump file | |
| # inpath and write it to outpath | |
| inpath = "AgNWSiO2.xyz" | |
| outpath = "data.AgNWSiO2" | |
| df = open(inpath, "r") | |
| buf = [] | |
| i = 0 | |
| for l in df: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| ##xargs -a files.txt -n2 sh -c '(echo "16i $(echo $1 | tr '[:lower:]' '[:upper:]') P" | dc) > $0' | |
| xargs -a files.txt -n2 sh -c 'echo $1 | xxd -r -p - $0' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Roni Koitermaa 2022 | |
| # Plotting code using Matplotlib | |
| # Line/scatter plots, subplots, histogram plot, bar plot | |
| import numpy as np | |
| from matplotlib import rc | |
| import matplotlib.pyplot as plt | |
| import matplotlib.ticker as mtick | |
| # line + scatter plot of multiple data sets a |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # set audio and subtitle track 2 as default in mkv files (typically japanese with english subtitles) | |
| for file in *.mkv ; do | |
| mkvpropedit "$file" --edit track:a1 --set flag-default=0 --set flag-forced=0 \ | |
| --edit track:a2 --set flag-default=1 --set flag-forced=0 \ | |
| --edit track:s1 --set flag-default=0 --set flag-forced=0 \ | |
| --edit track:s2 --set flag-default=1 --set flag-forced=0 | |
| done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Download series .ts files and concatenate into mp4 using ffmpeg | |
| # Usage: tsdl <url> <file prefix i.e. prefix_0.ts> | |
| if [ $# != 2 ]; then | |
| echo "Usage: tsdl <url> <file prefix i.e. prefix_0.ts>" | |
| exit | |
| fi | |
| echo "ffconcat version 1.0" > tsdl_list.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Fourier analysis of piano hammer shapes on string. | |
| # Hammers of different shapes hit piano string at different points, | |
| # what is the frequency spectrum? | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # line + scatter plot of multiple data sets a | |
| def linescatter(a, titles=["", "", ""], labels=[], styles=[], fpath="", cm=plt.cm.rainbow): | |
| f = plt.figure(figsize=(10, 10)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| # line + scatter plot of multiple data sets a | |
| def linescatter(a, titles=["", "", ""], labels=[], styles=[], fpath=""): | |
| f = plt.figure(figsize=(10, 10)) | |
| plt.rcParams.update({'font.size': 22}) | |
| colors = plt.cm.plasma(np.linspace(0, 1, len(a))) | |
| plt.rcParams['axes.prop_cycle'] = plt.cycler(color=colors) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import numpy as np | |
| class Passenger: | |
| walkspd = 0.5 # walking speed | |
| storespd = 30 # luggage storing speed | |
| swapspd = 15 # seat swapping speed | |
| def __init__(self, aislerow, seatrow, seatcol): | |
| self.x = 0 # at gate | |
| self.aislerow = int(aislerow) |
NewerOlder