Skip to content

Instantly share code, notes, and snippets.

View arsdragonfly's full-sized avatar

Zheyu Shen arsdragonfly

View GitHub Profile
@arsdragonfly
arsdragonfly / download_trivy_windows.py
Created September 12, 2025 19:58
Download Trivy on Windows
#!/usr/bin/env python3
"""
Download and extract Trivy Windows binary (trivy.exe) into a "trivy" folder.
Usage:
python download_trivy_windows.py [--version X.Y.Z]
If --version is omitted the script queries the GitHub API for the latest release.
"""
import argparse
@arsdragonfly
arsdragonfly / game_of_life.rs
Created January 26, 2025 04:31
game of life Rust
#[bench]
fn game_of_life(b: &mut Bencher) {
// naive Vec implementation
const size_board_side: usize = 1024 * 8;
// 1d vec
let mut board = vec![0u8; size_board_side * size_board_side];
let mut next_state: Vec<u8> = vec![0; size_board_side * size_board_side];
// random initialization
// outermost ring is invalid
for i in 1..size_board_side - 1 {
@arsdragonfly
arsdragonfly / game-of-life.py
Last active January 26, 2025 04:30
game of life cuDF
# game of life
import cupy as cp
import cudf
import time
dim_x = 1024 * 8
dim_y = 1024 * 8
df = cudf.DataFrame({
Set-NetConnectionProfile -Name "Network" -NetworkCategory Private
Get-NetConnectionProfile
module Main
import Data.List
data Creep : Type where [external]
data Flag : Type where [external]
moveTo : (HasIO io) => Creep -> Flag -> io ()
moveTo creep flag = pure ()
@arsdragonfly
arsdragonfly / icecream.kk
Last active August 2, 2021 13:21
Algebraic Interrupts (Effects) using Koka
import std/num/random
effect control eat-icecream() : ()
effect control check-cost() : int // returns the cost in int
fun my-eat-icecream() {
eat-icecream();
val cost = check-cost();
if (cost > 2)
{
@arsdragonfly
arsdragonfly / split_uma.ts
Created January 17, 2021 03:13
splitting uma in typescript
import * as R from 'ramda'
let points = [31000, 31000, 31000, 7000]
let uma = [30000, 10000, -10000, -30000]
let points_and_uma = R.zip(points, uma)
let grouped_by_tie = R.groupWith((a, b) => a[0] == b[0], points_and_uma)
let process_ties = (ties: [number, number][]) => {
let total_uma = R.sum(R.map(t => t[1], ties))
let average_uma = total_uma / ties.length
@arsdragonfly
arsdragonfly / portfolio.md
Last active February 19, 2020 06:50
Zheyu Shen Portfolio
[10:56:33 PM][spawn Spawn1]
[10:56:33 PM]room
[10:56:33 PM][room W4N8]
[10:56:33 PM]name
[10:56:33 PM]([(Right "Bella")] : Nil)
[10:56:33 PM][structure (controller) #946b07739d98cb7]
[10:56:33 PM]structureType
[10:56:33 PM][spawn Spawn1]
[10:56:33 PM]structureType
[10:56:33 PM][spawn Spawn1]