This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
print_usage() { | |
echo "usage: compress_video <input_file>" | |
echo "supported formats: mp4, webm, mkv, mov, avi, flv" | |
} | |
get_extension() { | |
f="${1##*/}" | |
case "$f" in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# https://github.com/dependabot/fetch-metadata#enabling-auto-merge | |
name: Auto-merge Dependabot | |
on: pull_request_target | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks. | |
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/) | |
(() => { | |
const SHOW_SIDES = false; // color sides of DOM nodes? | |
const COLOR_SURFACE = true; // color tops of DOM nodes? | |
const COLOR_RANDOM = false; // randomise color? | |
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com) | |
const MAX_ROTATION = 180; // set to 360 to rotate all the way round | |
const THICKNESS = 20; // thickness of layers | |
const DISTANCE = 10000; // ¯\\_(ツ)_/¯ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useState } from "react"; | |
type UseTextSelectionReturn = { | |
text: string; | |
rects: DOMRect[]; | |
ranges: Range[]; | |
selection: Selection | null; | |
}; | |
const getRangesFromSelection = (selection: Selection): Range[] => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
function p() { | |
jq -n \ | |
--arg content "$*" \ | |
'{ | |
"model": "pplx-7b-online", | |
"messages": [ | |
{ | |
"role": "system", | |
"content": "Be precise and concise." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pip install beautifulsoup4 requests markdownify mistletoe | |
# command line usage: python chunkpaper.py 'https://ar5iv.org/abs/1910.06709' | |
# will dump the HTML, Markdown, and finally the chunk JSON | |
# note that (as of Nov 8 '23) ar5iv only has arxiv papers converted up to the end of October, | |
# but if you need something more recent you could probably do the LaTeX→HTML conversion yourself | |
# library usage: call `chunk` with some ar5iv HTML. will probably choke on anything else | |
import dataclasses |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from https://github.com/go717franciswang/peerjs-chatroom | |
const CLIENT_MSG = { | |
CHAT: 1, | |
GET_MEMBERS: 2, | |
}; | |
const SERVER_MSG = { | |
CHAT: 1, | |
MEMBERS: 2, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import glob from 'fast-glob' | |
import { build } from 'esbuild' | |
import { Project } from 'ts-morph' | |
const project = new Project({ | |
compilerOptions: { | |
outDir: 'dist', | |
emitDeclarationOnly: true, | |
}, | |
tsConfigFilePath: './tsconfig.json', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PORT=xxx | |
COGNITO_USER_POOL_ID=xxx | |
COGNITO_CLIENT_ID=xxx | |
COOKIE_SESSION_SECRET=xxx | |
COOKIE_SESSION_NAME=xxx | |
AWS_REGION=xxx | |
AWS_ACCESS_KEY_ID=xxx | |
AWS_SECRET_ACCESS_KEY=xxx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {MDXProvider} from '@mdx-js/react'; | |
import {MDXComponents} from 'components/MDX/MDXComponents'; | |
import {Toc} from 'components/Toc/Toc'; | |
import * as React from 'react'; | |
export interface MarkdownProps<Frontmatter> { | |
meta: Frontmatter; | |
children?: React.ReactNode; | |
} |
NewerOlder