Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
def convert_print(text): | |
index_of_print = text.find(PRINT) | |
if index_of_print != -1: | |
# find the argument of print | |
arg = text[index_of_print + len(PRINT):] | |
# Strip left white space using built-in string method lstrip() | |
# If line is print statement, use the format() method to add insert parentheses | |
return 'print({})'.format(arg.lstrip()) | |
else: | |
return text |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
inputs.txt: | |
file 'GOPR4405.MP4' | |
file 'GP014405.MP4' | |
ffmpeg -f concat -i inputs.txt -c copy trail.mp4 |
This file contains 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
find . -iname '*.csv' -print0 | xargs -0 tar -cvf somefile.tar -T - |
This file contains 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
find . -iname '*.csv' -print0 | xargs -0 zip csv_files.zip -@ |
This file contains 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
''' | |
Run like: | |
abaqus cae noGUI=abaqusToOpenFOAM.py -- path/to/cae/model model-name | |
# So the polymesh will be upper diagonal | |
renumberMesh -overwrite | |
# Make sure all is OK | |
checkMesh | |
# If model built in mm | |
transformPoints -scale '(1e-3 1e-3 1e-3)' |
This file contains 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
from numpy.random import choice | |
JACKPOT = 1.5e9 | |
NUM_TICKETS = 1000 | |
def gen_numbers(): | |
''' | |
Pick 5 numbers, without replacement, from 1-69 | |
and the powerball from 1-26 | |
This file contains 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 | |
from scipy.interpolate import interp1d | |
from pylab import plt | |
def process_rpt(fname): | |
with open(fname, 'rb') as f: | |
lines = f.readlines() | |
lines_cleaned = [] | |
for line in lines: | |
# Strip leading and trailing whitespace |
NewerOlder