Skip to content

Instantly share code, notes, and snippets.

View bpevs's full-sized avatar
🎵
vx1.bpev.me

Ben Pevsner bpevs

🎵
vx1.bpev.me
  • Previously @ Playstation Network, Honey
  • 15:22 (UTC +07:00)
View GitHub Profile
@bpevs
bpevs / get-geofabrik-regions.ts
Created December 26, 2024 13:42
Script for fetching a list of the regions geofabrik generates
/**
* All of these regions should have a `.poly` and a `-latest.osm.pbf` file
* associated to them.
*/
import * as cheerio from "npm:cheerio"
const baseURL = "https://download.geofabrik.de/"
const regions = new Set()
// antarctica has no children, so not in baseRegions, but add to regions
@bpevs
bpevs / parse-dict.ts
Created October 18, 2024 04:22
Parse Dict
/**
* @description
* This is a modified version of parse-dictd to be used with Deno, using only
* std dependencies.
*
* @reference https://github.com/nvdnkpr/parse-dictd
*/
import { TextLineStream } from "jsr:@std/streams/text-line-stream";
import { toTransformStream } from "jsr:@std/streams/to-transform-stream";
@bpevs
bpevs / parse-cedict.ts
Last active October 18, 2024 04:22
CC-CEDICT File to JSON
/**
* @description
* This is a simplified version of cedict2json.js by Kevin Yang, modified to be
* run with deno, only using std dependencies.
*
* @reference https://github.com/kevb34ns/CEDICT2JSON/blob/master/cedict2json.js
* @reference https://www.mdbg.net/chinese/dictionary?page=cc-cedict
*
* CC-CEDICT is licensed under the Creative Commons Attribution-Share
* Alike 3.0 License (https://creativecommons.org/licenses/by-sa/3.0/).
@bpevs
bpevs / takeout_to_geojson.js
Last active November 19, 2023 00:37
Parse Google Takeout results into a geojson file
// Google maps does already export to geo-json, but that doesn't take lists
// into account. This script maps the `Saved` csv files, maps data to
// `Maps (your places)`, and outputs a set of geojson files for each list.
// Requirements:
// - All locations must be "starred". This puts it in the "Saved Places.json".
//. - Notes can be in a list location.
// - Lists must NOT HAVE a "List description". It fucks up the csv parsing.
// Once you verify this, create a Google takeout that includes:
@bpevs
bpevs / README.md
Last active January 31, 2024 17:45
Solidjs + Esbuild + Deno

git clone [email protected]:8aa43ff2c0f6e2632b204b0988fd2417.git

Start via deno task start

main.js builds and runs a dev server index.tsx is client entry point

@bpevs
bpevs / 冰茶.js
Last active November 19, 2023 00:37
GIVE ME TEA
const weather_to_drink_temp_map = {
'0': "正常冰",
'1': "正常冰",
'2': "少冰",
'3': "少冰",
'71': "熱",
'73': "熱",
'75': "熱",
'77': "熱",
'95': "熱",
@bpevs
bpevs / create-pls.js
Created November 8, 2022 12:49
Create VX1 .pls for bpev.me/blog/vx1 sessions
import titleCase from "https://deno.land/x/[email protected]/titleCase.ts";
const [dir, postDir] = Deno.args;
const contents = [];
for await (const file of Deno.readDir(dir)) {
if (file.name[0] === ".") continue;
contents.push(file);
}
@bpevs
bpevs / README.md
Last active July 29, 2022 21:01
Simple TSX App: Deno + React + Typescript

Simple TSX App: Deno + React + Typescript

The simplest Typescript + React app I could come up with. Uses Deno because the runtime has out-of-the-box support for Typescript and TSX.

Usage

You need to install Deno to run this app: https://deno.land#installation

@bpevs
bpevs / parse-unicode-emoji-list.ts
Last active June 3, 2022 01:07
Parse and build a js obj with the unicode data
// Builds obj from unicode emoji-test text
// https://unicode.org/Public/emoji/14.0/emoji-test.txt
// http://www.unicode.org/reports/tr51/
// Usage:
// deno run --allow-net fetch-emoji.ts
type Qualification = "fully-qualified" | "minimally-qualified" | "unqualified";
interface EmojiObj {
@bpevs
bpevs / README.md
Last active May 8, 2022 19:44
Small script I used to bruteforce my ethereum password

ETH Keystore Guided Bruteforce

A small script I used to bruteforce my ethereum password for a really old wallet from list of possible passphrase combinations. It did the job at that time (phew)! Originally built in node.js, I rejiggered to be a deno app so I wouldn't need to push package.json, and to make importing json files look cleaner. Replace example json files with actual files to use.

keystore.json is the wallet keystore