Skip to content

Instantly share code, notes, and snippets.

View basnijholt's full-sized avatar

Bas Nijholt basnijholt

View GitHub Profile
@basnijholt
basnijholt / slurm-vscode.sh
Last active September 30, 2025 22:56
slurm-vscode.sh
#!/usr/bin/env bash
# slurm-vscode.sh - VS Code launcher for Slurm
# - Reads ~/.config/slurm_vscode/config (or $XDG_CONFIG_HOME)
# - Remembers JobID in ~/.cache/slurm_vscode/jobid (or $XDG_CACHE_HOME)
# - Reuses a running job if possible; otherwise submits a tiny "sleep infinity" holder job
# - Launches local VS Code against the remote node via "ssh-remote+<node>"
set -euo pipefail
APP_NAME="slurm_vscode"
#!/bin/bash
# filepath: fix_lib_paths.sh
# https://github.com/conda-forge/numpy-feedstock/issues/347#issuecomment-2746317575
# Activate the conda environment and run this script.
set -e
LIB_PATH="$CONDA_PREFIX/lib"
# Find all dylib files
@basnijholt
basnijholt / rolling-average-ticker-price.py
Last active February 20, 2025 21:41
rolling-average-ticker-price.py
# /// script
# dependencies = [
# "yfinance",
# ]
# ///
import yfinance as yf
from datetime import datetime, date
import argparse
import pandas as pd
import asyncio
import json
import os
from rattler import (
Environment,
LockFile,
Platform,
VirtualPackage,
solve_with_sparse_repodata,
)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>PipeFunc Graph</title>
<script src="https://unpkg.com/[email protected]/dist/jquery.min.js"></script>
<script src="https://unpkg.com/[email protected]/jquery.mousewheel.js"></script>
<script src="https://unpkg.com/[email protected]/dist/jquery.color.js"></script>
<script src="https://unpkg.com/[email protected]/dist/d3.min.js"></script>
digraph {
graph [bb="0,0,783.73,403",
rankdir=LR
];
node [label="\N",
shape=rectangle
];
subgraph cluster_legend {
graph [bb="8,312,775.73,395",
color=black,
@basnijholt
basnijholt / clean_notebook.sh
Created November 26, 2021 16:09
Clean up and lint a notebook with black, isort, autoflake, pyupgrade
NB=FNAME.ipynb
pip install nbqa autoflake pyupgrade black isort nbconvert jupyter_contrib_nbextensions
nbqa isort $NB
nbqa black $NB
nbqa autoflake -i --remove-all-unused-imports $NB
nbqa pyupgrade $NB --py38-plus
jupyter nbconvert --clear-output --inplace $NB
@basnijholt
basnijholt / cto_line.pine
Created September 18, 2021 08:23
CTO Line indicator for TradingView
//@version=4
study(title="CTO Line", shorttitle="CTO", overlay=true, resolution="")
smma(src, length) =>
smma = 0.0
smma := na(smma[1]) ? sma(src, length) : (smma[1] * (length - 1) + src) / length
smma
v1 = smma(hl2, 15)
m1 = smma(hl2, 19)
m2 = smma(hl2, 25)
v2 = smma(hl2, 29)
sudo su
dd if=/dev/sda1 of=./sda1.image
dd if=/dev/sda2 of=./sda2.image
dd if=/dev/sda3 of=./sda3.image
dd if=/dev/sda4 of=./sda4.image
dd if=/dev/sda5 of=./sda5.image
dd if=/dev/sda6 of=./sda6.image
dd if=/dev/sda7 of=./sda7.image
zip test.zip sda*
import matplotlib.tri as mtri
from matplotlib import pyplot as plt
def plot_loss(learner, cmap="viridis", xy_size=(10, 10)):
fig, ax = plt.subplots(figsize=xy_size)
x_size, y_size = xy_size
ip = learner.ip()
zs = learner.loss_per_triangle(ip)
tri = ip.tri