Skip to content

Instantly share code, notes, and snippets.

@RuyiLi
RuyiLi / d1p1.jl
Last active January 21, 2020 14:20
AOC 2018 Solutions For Google Code-In
# Author: weCryOpen (Ruyi Li)
function d1p1(file)
open(file) do f
total = 0
for line in eachline(f)
# Iterate through each line in the file
# Convert it to an integer,
n = parse(Int, line)
# and add it to the total.
# Generated by Powerlevel10k configuration wizard on 2021-06-28 at 18:35 EDT.
# Based on romkatv/powerlevel10k/config/p10k-lean.zsh, checksum 19275.
# Wizard options: nerdfont-complete + powerline, small icons, unicode, lean, 12h time,
# 1 line, compact, many icons, concise, instant_prompt=verbose.
# Type `p10k configure` to generate another config.
#
# Config for Powerlevel10k with lean prompt style. Type `p10k configure` to generate
# your own config based on it.
#
# Tip: Looking for a nice color? Here's a one-liner to print colormap.
@RuyiLi
RuyiLi / cssvalue.ts
Created April 20, 2023 18:31
TS compile time $token substitution
const theme = {
color: 'blue',
padding: '1px 2px',
margin: '2px $padding $size',
size: '3rem'
} as const
type CSSSingleVarToken<S extends string> = S extends `$${infer _} ${infer _}`
? never
: S extends `$${infer K}`
@RuyiLi
RuyiLi / bee.ts
Last active May 29, 2023 22:59
5153 - IndexOf
import type { Equal } from '@type-challenges/utils'
type IndexOf<T, U, C extends `According to all known laws of aviation, there is no way a bee should be able to fly.
Its wings are too small to get its fat little body off the ground.
The bee, of course, flies anyway because bees don't care what humans think is impossible.
Yellow, black. Yellow, black. Yellow, black. Yellow, black.
Ooh, black and yellow!
Let's shake it up a little.
Barry! Breakfast is ready!
Coming!
@RuyiLi
RuyiLi / asdf.js
Created June 12, 2024 00:46
lol-guessr-script
g=document.querySelector('.leaflet-image-layer');l=[{lat:74.125,lng:117.53125,img:"/lol-guessr/assets/eyJsYXQiOjc0LjEyNSwibG5nIjoxMTcuNTMxMjV9.png"},{lat:74.625,lng:145.8125,img:"/lol-guessr/assets/eyJsYXQiOjc0LjYyNSwibG5nIjoxNDUuODEyNX0=.png"},{lat:75.75,lng:31,img:"/lol-guessr/assets/eyJsYXQiOjc1Ljc1LCJsbmciOjMxfQ==.png"},{lat:76.125,lng:35.90625,img:"/lol-guessr/assets/eyJsYXQiOjc2LjEyNSwibG5nIjozNS45MDYyNX0=.png"},{lat:77.625,lng:121.65625,img:"/lol-guessr/assets/eyJsYXQiOjc3LjYyNSwibG5nIjoxMjEuNjU2MjV9.png"},{lat:78,lng:60.78125,img:"/lol-guessr/assets/eyJsYXQiOjc4LCJsbmciOjYwLjc4MTI1fQ==.png"},{lat:78.9375,lng:54.46875,img:"/lol-guessr/assets/eyJsYXQiOjc4LjkzNzUsImxuZyI6NTQuNDY4NzV9.png"},{lat:79.125,lng:134.3125,img:"/lol-guessr/assets/eyJsYXQiOjc5LjEyNSwibG5nIjoxMzQuMzEyNX0=.png"},{lat:79.37501161349434,lng:80.31251297978778,img:"/lol-guessr/assets/eyJsYXQiOjc5LjM3NTAxMTYxMzQ5NDM0LCJsbmciOjgwLjMxMjUxMjk3OTc4Nzc4fQ==.png"},{lat:70.9375,lng:45.84375,img:"/lol-guessr/assets/eyJsYXQiOjcwLjkzNzUsImxuZyI6ND
@RuyiLi
RuyiLi / signalrecords.ps1
Last active July 8, 2024 23:20
ERIDU.GG Signal Records Script
# Copyright 2024 ERIDU.GG
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,