Skip to content

Instantly share code, notes, and snippets.

View qwo's full-sized avatar

Stanley Zheng qwo

View GitHub Profile
from fractions import Fraction as f
import math
def decompose(n):
frac = f(n)
out = []
current_denom = 1
if frac >= 1:
number = int(frac)
@puffnfresh
puffnfresh / F.d.ts
Last active January 20, 2017 08:18
declare namespace F {
class Either<A, B> {
private constructor();
// Hack to make A and B covariant.
private a: A;
private b: B;
static Left<A, B>(a: A): Either<A, B>;
static Right<A, B>(b: B): Either<A, B>;
;; dispatcher is a work in progress haha
(define-syntax dispatcher
(lambda (x)
(syntax-case x (else)
((d name (case1 do1 ...) ... )
(with-syntax ( (args (datum->syntax #'d 'args)) )
#'(define (name m . args)
(case m
(case1 do1 ...) ...
(else (error (symbol->string 'name) "bad operation" m)))))))))
@hoesler
hoesler / install_jenkins_plugin.sh
Last active February 9, 2024 16:28 — forked from micw/install_jenkins_plugin.sh
Script to install one or more jenkins plugins including dependencies while jenkins is offline
#!/usr/bin/env bash
set -e
set -o pipefail
plugin_repo_url="http://updates.jenkins-ci.org/download/plugins"
plugin_dir="/var/lib/jenkins/plugins"
include_optionals=false
showUsage() {
@mosquito
mosquito / README.md
Last active April 13, 2025 18:03
Add doker-compose as a systemd unit

Docker compose as a systemd unit

Create file /etc/systemd/system/[email protected]. SystemD calling binaries using an absolute path. In my case is prefixed by /usr/local/bin, you should use paths specific for your environment.

[Unit]
Description=%i service with docker compose
PartOf=docker.service
After=docker.service
@sursh
sursh / README.md
Last active September 27, 2017 22:42
Introducing RC Connections

RC Connections is a way of connecting with others in the Recurse Center community.

Rooted in the belief that everyone has experience and skills that are valuable to someone else, we have no separate list for mentors and mentees. We are all mentors. We are all mentees. For example, Sasha and Andrew had a phone chat recently where she helped him structure a talk he was working on and he told her about the master’s program he recently finished, as she’s considering doing one herself.

If you know a specific person in RC that you'd like to talk with, then you should probably reach out to them directly! RC Connections is meant to facilitate discussion when it's not obvious that a potential connection should happen.

This service is organized by alumni (currently, Sasha and Andrew). Furthermore, RC Connections is an experiment. We welcome and encourage feedback. Please use the #connections Zulip stream to discuss.

How it works:

  • We’ll start on a ~monthly rhythm
@crittermike
crittermike / wget.sh
Last active March 28, 2025 18:44
Download an entire website with wget, along with assets.
# One liner
wget --recursive --page-requisites --adjust-extension --span-hosts --convert-links --restrict-file-names=windows --domains yoursite.com --no-parent yoursite.com
# Explained
wget \
--recursive \ # Download the whole site.
--page-requisites \ # Get all assets/elements (CSS/JS/images).
--adjust-extension \ # Save files with .html on the end.
--span-hosts \ # Include necessary assets from offsite as well.
--convert-links \ # Update links to still work in the static version.
@nkavadias
nkavadias / pi-hole-workshop-instructions-using-Rpi.md
Last active March 25, 2024 14:45
Raspberry Pi instructions for Pi-hole setup
class Magic {
constructor(fn, a) {
this.__chain = [[fn, a]];
}
get(t, a) {
if (a == "✨✨MAGIC✨✨") return true;
if (a == "resolve") {
return () => Magic.chain(this.__chain);
}
return (...b) => {