Accompanies OnCFD Newsletter #158
Attached is an example ParaView script to create a "run receipt" summary of your results like this 👇
Straight from the command-line & ready to post into Slack/Teams/WhatsApp
Accompanies OnCFD Newsletter #158
Attached is an example ParaView script to create a "run receipt" summary of your results like this 👇
Straight from the command-line & ready to post into Slack/Teams/WhatsApp
It's a pain in the butt! there's no google-provided way to do it and the extensions that were written to do it are all terrible or non-functional. Luckily, youtube runs on "computers" and "computers" can be "hackarino'd" with just a bit of encouragement. Prereqs are a) ability to follow instructions b) maybe some familiarity with bash. I'm writing this from my mac, it'll be the sameish on linux and WSL.
This is for non-"brand" accounts, cause i'm not a brand. I'm a small business man, not a small business, man. I'm not a man either but whatever.
This at least is easy.
These are the current alternatives (with links when possible):
@ECHO OFF | |
SETLOCAL EnableDelayedExpansion | |
REM Insert your conda env here | |
SET CONDA_ENV=MY_DESIRED_CONDA_ENV | |
CALL :activate_conda_env | |
REM Insert your python script here |
using namespace System.Collections.Generic | |
# Encapsulate an arbitrary command | |
class PaneCommand { | |
[string]$Command | |
PaneCommand() { | |
$this.Command = ""; | |
} |
using namespace System.Management.Automation | |
using namespace System.Management.Automation.Language | |
if ($host.Name -eq 'ConsoleHost') | |
{ | |
Import-Module PSReadLine | |
} | |
#Import-Module PSColors | |
#Import-Module posh-git | |
Import-Module -Name Terminal-Icons |
{ | |
"final_space": true, | |
"console_title": true, | |
"console_title_style": "folder", | |
"blocks": [ | |
{ | |
"type": "prompt", | |
"alignment": "left", | |
"horizontal_offset": 0, | |
"vertical_offset": 0, |
# We need to ensure that c encoder will not be launched | |
@patch('json.encoder.c_make_encoder', None) | |
def json_dumps_with_two_digit_float(some_object): | |
# saving original method | |
of = json.encoder._make_iterencode | |
def inner(*args, **kwargs): | |
args = list(args) | |
# fifth argument is float formater which will we replace | |
args[4] = lambda o: '{:.2f}'.format(o) | |
return of(*args, **kwargs) |
# Source: https://stackoverflow.com/a/33597599/5391200 | |
from pylab import * | |
cmap = cm.get_cmap('seismic', 5) # matplotlib color palette name, n colors | |
for i in range(cmap.N): | |
rgb = cmap(i)[:3] # will return rgba, we take only first 3 so we get rgb | |
print(matplotlib.colors.rgb2hex(rgb)) | |
cmap = cm.get_cmap('plasma', 101) |
@echo OFF | |
rem How to run a Python script in a given conda environment from a batch file. | |
rem It doesn't require: | |
rem - conda to be in the PATH | |
rem - cmd.exe to be initialized with conda init | |
rem Define here the path to your conda installation | |
set CONDAPATH=C:\ProgramData\Miniconda3 | |
rem Define here the name of the environment |