Skip to content

Instantly share code, notes, and snippets.

View arsdragonfly's full-sized avatar

Zheyu Shen arsdragonfly

View GitHub Profile
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]
@arsdragonfly
arsdragonfly / foo.hs
Created October 27, 2019 03:44
let to where
findChanges :: Money -> [Money] -> Maybe [Money]
findChanges bill changes
| bill == 0 = Just changes
| bill < 0 = Nothing
| [] <- changes = Nothing
| (x : xs) <- changes = let result = findChanges (bill - x) xs in case result of Just c -> Just c
Nothing -> findChanges bill xs
@arsdragonfly
arsdragonfly / checkpae.sh
Created June 13, 2013 09:54
PlayerArgsEnd error solution.
#!/bin/bash
#Don't change my filename.
#Put it into your worlds/(worldname)/players folder
#and execute this script.
FILES=./*
for f in $FILES
do
if [ "$f"x = "./checkpae.shx" ]; then
continue
else