Skip to content

Instantly share code, notes, and snippets.

@jbwhit
jbwhit / example-ruff-formatting.ipynb
Last active April 11, 2024 17:25
Steps to use `ruff` in JupyterLab with the `jupyterlab_code_formatter` plugin.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bollwyvl
bollwyvl / nbconvert-in-jupyterlite.ipynb
Last active July 28, 2023 17:21
nbconvert in jupyterlite
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mahdyar
mahdyar / cPanel.yml
Created September 8, 2021 20:56
Deploy to cPanel with GitHub Actions (FTP)
name: Deploy to cPanel
on:
push:
branches:
- master
jobs:
FTP-Deploy-Action:
name: FTP-Deploy-Action
runs-on: ubuntu-latest
steps:
@FilBot3
FilBot3 / 00_README.md
Last active March 30, 2024 04:22
Trying to use VSCode from a Flatpak using Podman-Remote to connect to Host to use DevContainers
@koirikivi
koirikivi / bench_cached_property_decorator.py
Last active September 20, 2023 15:51 — forked from smithdc1/bench_cached_property_decorator.py
Benchmark of Django and Python's cached_property decorators (with IO and multithreading)
import pyperf
import time
from concurrent.futures import ThreadPoolExecutor
from django.utils.functional import cached_property as dj_cached_property
from functools import cached_property as py_cached_property
# Most web requests have some IO, like database access. Simulate with sleeping
SLEEP_TIME = 0.01
#!/bin/bash
#save as install-k3d.sh
#az vm create -g k3s --image UbuntuLTS --admin-username ubuntu --ssh-key-values ~/.ssh/id_rsa.pub -n k3s --custom-data install-k3d.sh
#az network nsg rule create -g k3x --nsg-name k3xNSG --priority 1002 --access Allow --protocol Tcp --destination-port-ranges 443 -n https
#az network nsg rule create -g k3x --nsg-name k3xNSG --priority 1001 --access Allow --protocol Tcp --destination-port-ranges 80 -n http
curl https://get.docker.com/ | sh
sudo usermod -aG docker ubuntu
@mwouts
mwouts / jupyter_notebook_config.py
Last active September 22, 2020 13:25
A save hook for Jupyter that automatically exports notebooks as slides
"""This is a save hook for Jupyter that automatically exports your notebook to reveal slides,
every time you save it, if
- it has at least one cell with a "slideshow" metadata
- and if the notebook is not `Untitled...`
Add the following to your `.jupyter/jupyter_notebook_config.py` file:
(source: https://gist.github.com/mwouts/04a6dfa571bda5cc59fa1429d130998f )
"""
import io
@cnlohr
cnlohr / forgot_to_check_out_with_recurse_submodules.md
Last active March 9, 2024 11:59
Git forgot to clone recursively (forgot to check out with recurse submodules)
@mkrkn
mkrkn / zz_firewall_add_network.sh
Last active May 25, 2020 01:45
A sample snippet for editing OpenWrt firewall zone configuration via the UCI command interface. As zone sections are anonymous sections some extra code is needed to discover them. To the extent that the work is copyrightable, it is licensed under the MIT/X11 License.
#!/bin/sh
# Copyright (c) 2020 Magnus Kroken
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
@premek
premek / mv.sh
Last active March 5, 2024 17:43
Rename files in linux / bash using mv command without typing the full name two times
# Put this function to your .bashrc file.
# Usage: mv oldfilename
# If you call mv without the second parameter it will prompt you to edit the filename on command line.
# Original mv is called when it's called with more than one argument.
# It's useful when you want to change just a few letters in a long name.
#
# Also see:
# - imv from renameutils
# - Ctrl-W Ctrl-Y Ctrl-Y (cut last word, paste, paste)