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
# How many unique ways are there to add positive integers to get the number N? | |
# https://oeis.org/A000041 | |
from itertools import count, chain, islice | |
def partitions(): | |
""" | |
>>> list(islice(partitions(), 20)) | |
[1, 1, 2, 3, 5, 7, 11, 15, 22, 30, 42, 56, 77, 101, 135, 176, 231, 297, 385, 490] |
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/bash | |
# Account information. | |
OP_EMAIL=<email> | |
OP_MOUNTPOINT=/home/<username>/pCloudDrive | |
OP_USER_ID=<user-id> # Gotten from `op account list`. | |
# Stop server. | |
if [[ $1 == 'stop' ]]; then | |
expect -f - >/dev/null <<END_EXPECT |
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 | |
# /etc/acpi/handler.sh | |
TARGET_UID=1000 | |
my_pactl() { | |
setpriv --reuid $TARGET_UID sh -c "XDG_RUNTIME_DIR=/run/user/$TARGET_UID pactl $*" | |
} | |
case "$1" 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
$ cargo run --example=greeter_server | |
Compiling grpcio-sys v0.12.1+1.46.5-patched | |
error: failed to run custom build command for `grpcio-sys v0.12.1+1.46.5-patched` | |
Caused by: | |
process didn't exit successfully: `/home/user/third-party-code/grpc-rs/target/debug/build/grpcio-sys-1aa460d92b7351db/build-script-build` (exit status: 101) | |
--- stdout | |
cargo:rerun-if-changed=grpc_wrap.cc | |
cargo:rerun-if-changed=grpc |
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
from collections import deque | |
from contextlib import contextmanager | |
from curses.ascii import ESC, ETX | |
import sys | |
import termios | |
import tty | |
ESC = chr(ESC) | |
ETX = chr(ETX) |
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
Human: | |
Which version of Claude am I speaking with? | |
Claude: | |
You are speaking with Claude, an AI assistant created by Anthropic. My knowledge | |
base was last updated in August 2023, but I don't have information on specific | |
version numbers. How may I assist you today? | |
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
def gcd_extended(a, b): | |
""" | |
Compute the greatest common divisor of a and b, along with Bezout | |
coefficients s and t, such that gcd(a, b) a*s + b*t. | |
Returns (gcd(a, b), s, t, lcm(a, b)). | |
23 * 240 - 120 * 46 = 2 | |
>>> gcd_extended(240, 46) | |
(2, -9, 47, 5520) | |
""" |
OlderNewer