Skip to content

Instantly share code, notes, and snippets.

View WindSoilder's full-sized avatar

Wind WindSoilder

View GitHub Profile
@WindSoilder
WindSoilder / glob_torture.nu
Last active February 21, 2024 02:32 — forked from kubouch/glob_torture.nu
Stress test for globbing in Nushell
# Glob Torture Test
## This is a stress test for globbing.
# 1. Put the file to an empty directory.
# 2. Edit file to remove markdown.
# 3. Run `nu glob_torture.nu`
# 4. Fix TODOs
use std assert
@WindSoilder
WindSoilder / kpod.nu
Created November 29, 2023 08:16
k8s commands utils
def select-pod [pods: list<string>] {
let length = $pods | length
if $length == 0 {
error-make -u "no pod match"
} else if $length == 1 {
$pods | get 0
} else {
print -e "Have selected more than 1 pods"
print -e $pods
let index = (input "select the index: ") | into int
@WindSoilder
WindSoilder / set_cookie.md
Created October 19, 2023 07:46
simple demo
import asyncio
result = []
async def consumer(generator):
async for x in generator:
result.append(x)
async def main():
tasks = []
for f in fs:
"""
The script will walk through current directory, for each `.nu` file,
try to rename variable like `aa-bb` to `aa_bb`.
For example:
1. `let aa-bb` => `let aa_bb`
2. `let-env aa-bb` => `let-env aa_bb`
3. `$aa-bb` => `$aa_bb`
Required python version: python3.6+
@WindSoilder
WindSoilder / config.yml
Created July 6, 2022 02:08 — forked from LukeMathWalker/config.yml
CircleCI - Rust setup
version: 2
jobs:
build-and-test:
docker:
- image: circleci/rust
environment:
# Fail the build if there are warnings
RUSTFLAGS: '-D warnings'
steps:
- checkout
@WindSoilder
WindSoilder / handler.py
Last active February 17, 2019 00:27
test for handler chian when sub-handler re-raise exceptiongroup
""" Test script for the HandlerChain.
From here we can see the output exception after HandlerChain handled.
"""
from exceptiongroup import HandlerChain, ExceptionGroup
chain = HandlerChain()
def raise_error_with_context():