Skip to content

Instantly share code, notes, and snippets.

View kastnerp's full-sized avatar
:octocat:
Focusing

Patrick Kastner kastnerp

:octocat:
Focusing
View GitHub Profile
@robinknowles
robinknowles / ParaView Run Receipts.md
Created August 4, 2023 14:21
A scriptable method for producing run summary receipts for sharing in Slack/Teams/Whatsapp

Run Receipts in ParaView

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

@jackellenberger
jackellenberger / migrating_youtube_subscriptions.md
Created June 12, 2022 21:51
Migrating YouTube subscriptions from one account to another

Migrating YouTube subscriptions from one account to another

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.

1. Download your subscriptions with Takeout

This at least is easy.

  1. open youtube.com > profile icon > your data in youtube, should take you to myaccount.
@SkyyySi
SkyyySi / youtube-vanced-alternatives.md
Last active November 17, 2024 08:08
A list of alternatives after the shutdown of Vanced

NONE OF THESE CLIENTS ARE VERIFIED BY ME FOR SECURITY OR ANYTHING ELSE! USE AT YOUR OWN RISK!

These are the current alternatives (with links when possible):

@1kastner
1kastner / run_python_script_in_conda_env.bat
Last active October 13, 2024 09:33 — forked from maximlt/run_python_script_in_conda_env.bat
Run a Python script in a conda environment from a batch file
@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
@codebykyle
codebykyle / connect.ps1
Last active October 14, 2024 19:04
Windows Terminal Split Pane Powershell Script - v2
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
@shanselman
shanselman / ohmyposhv3-v2.json
Last active November 4, 2024 10:39
ohmyposhv3-v2
{
"final_space": true,
"console_title": true,
"console_title_style": "folder",
"blocks": [
{
"type": "prompt",
"alignment": "left",
"horizontal_offset": 0,
"vertical_offset": 0,
@Sukonnik-Illia
Sukonnik-Illia / my_json_dums.py
Last active August 25, 2023 09:20
Python 3 Json with 2 decimals after comma
# 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)
@jdbcode
jdbcode / get-hex-colors.py
Last active April 11, 2024 20:09
Get a list of n hex colors for a given matplotlib palette
# 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)
@Huud
Huud / Calculate_Mean_and_std_of_dataset.py
Created July 23, 2020 14:18
How to calculate the mean and standard deviation of an image dataset
# calculate mean and std deviation
from pathlib import Path
import cv2
imageFilesDir = Path(r'C:\your\dataset\dir\here\trainData')
files = list(imageFilesDir.rglob('*.png'))
# Since the std can't be calculated by simply finding it for each image and averaging like
# the mean can be, to get the std we first calculate the overall mean in a first run then