Skip to content

Instantly share code, notes, and snippets.

View jyc's full-sized avatar

jyc

View GitHub Profile
// cc -O3 -o dotproduct dotproduct.c -march=native -ffast-math
//
// Pretty much just Prof. Daniel Lemire's code, hacked by me
// All errors are mine
//
// Prof. Lemire says in https://github.com/lemire/Code-used-on-Daniel-Lemire-s-blog/blob/master/README.md:
// Unless otherwise stated, I make no copyright claim
// on this code: you may consider it to be in the public
// domain.
// Don't bother forking this code: just steal it.
@jyc
jyc / build-macos-xcode-app-and-publish-sparkle-update.sh
Last active November 9, 2023 06:32
Bash script to build a (macOS) Xcode app and publish an update using Sparkle
#!/bin/bash
set -euo pipefail
# TO CREATE ExportOptions.plist:
# Product > Archive then Window > Organizer > Archives, Distribute App, Distribute Directly doesn’t seem to work!
# Use Archives > Distribute App, Custom, Developer ID, Export seems to work… DO NOT click Upload!
#
# BEFORE RUNNING:
# Create an app-specific password; call it "Foobar Build Scripts": https://support.apple.com/en-us/102654
# Then run:
!nvcc --version
#nvcc: NVIDIA (R) Cuda compiler driver
#Copyright (c) 2005-2022 NVIDIA Corporation
#Built on Tue_Mar__8_18:18:20_PST_2022
#Cuda compilation tools, release 11.6, V11.6.124
#Build cuda_11.6.r11.6/compiler.31057947_0
%pip install -U --only-binary :all: xformers transformers==4.31.0 torch accelerate einops bitsandbytes==0.39.1 peft sentencepiece boto3 'tokenizers>=0.13.3'
--------------------
-- Window Chooser -- 🚻
--------------------
-- Originally: https://github.com/dmgerman/dmg-hammerspoon/blob/f8da75d121c37df40c0971336eb3f67c73d67187/dmg.spoon/init.lua#L115-L224
WC = {}
WC.wf = hs.window.filter.new()
WC.wf:setDefaultFilter{}
WC.currentWindows = {}
--------------------
-- Window Chooser -- 🚻
--------------------
-- Originally: https://github.com/dmgerman/dmg-hammerspoon/blob/f8da75d121c37df40c0971336eb3f67c73d67187/dmg.spoon/init.lua#L115-L224
WC = {}
WC.wf = hs.window.filter.new()
WC.wf:setDefaultFilter{}
WC.currentWindows = {}
function isLeapYear(date) {
var year = date.getFullYear();
if((year & 3) != 0) return false;
return ((year % 100) != 0 || (year % 400) == 0);
};
// https://stackoverflow.com/a/26426761
function getDOY(date) {
var dayCount = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
var mn = date.getMonth();
Manfred wonders, his head turgid and unnaturally slow. It's like being drunk, except much less pleasant: He can't seem to wrap his head around an idea from all angles at once, anymore. Is this what consciousness used to be like? It's an ugly, slow sensation. She turns away from him: "Medline says you'll be all right in a while. The main problem is the identity loss. Are you backed up anywhere?"
"Here." Alan, still top-hatted and mutton-chopped, holds out a pair of spectacles to Manfred. "Take these, they may do you some good." His topper wobbles, as if a strange A-life experiment is nesting under its brim.
"Oh. Thank you." Manfred reaches for them with a pathetic sense of gratitude. As soon as he puts them on, they run through a test series, whispering questions and watching how his eyes focus: After a minute, the room around him clears as the specs build a synthetic image to compensate for his myopia. There's limited Net access, too, he notices, a warm sense of relief stealing over him. "Do you mind if I c
#!/bin/zsh
cd "$2"
ellipsize() {
# Shouldn't add ellipsis if we didn't actually need to ellipsize.
ellipsized="$(echo "$1" | cut -f 1-8 -d' ' | cut -c 1-32)"
if [[ "$ellipsized" != "$1" ]]; then
echo "$ellipsized…"
else
PROMPT='%B%F{$PROMPT_COLOR}[%n@%m %1~%(#.#.)]%f%b $PROMPT_EXTRA%f
%B%F{$PROMPT_ARROW_COLOR}→%f%b '
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCt68un5eOfitUdgaRxEB57igdDx+8lpNZP9ej6RXVPHPdsWGAR1GyhVXtUwmVWVx9FOqR/svP74z0vDSDUOR9zyblgfFHpYWxrwPIT6U52jqS+bEg1riLqWb7Jsx67aVye6ejgdrmHeNkRzy9vIvR8VmwjuQl6G4/Anrt77m/TxHmRLXiutWkLEpdr6g5tfIKERmgfzeQx5JXLgWxpVF5STdQUP500iwYMLvFv79/uv27mPIm+o/Y+Do2CyraOtliHune0ThP2Qo7aK3bzRLSgRVfbd7S23uTGCAINpWY5CtMXpp5x3QX+njCxkdoQrsok4YcS1MwB6D7ZXdQ3oK+RI7DXpjrc0W0kYtBhkiSrB7qRh3/+S7xA37dDuyDXAqopqzNKRUW1sA1lHYW5uzd2Vx7F6af8DYMUxaqwCRf1P5hO2RmdlyICMqUqe74sTOFqb79uhbaNFBCeWjGuhzAqYM7XRHOFrcRyzbWOKCXJe8nGzpywMk6eo9pQMqfPpcMnMjyWGXvS6cHsnVLPuCFIbNQYavZOXGhb+zQTg47HPUV4YpyZR23FlK8ngevb4MNzx5EOQQimAkwchLnZeC67HssXjoB8h2WAePbh9COnN6Z4POyNp+4CqyaXyFYBhQSz8CiEA5JUhBF8ei/xMYkUSa49g+ynaOospk6KrjPAvw== jyc@jc-mb19-osx