Skip to content

Instantly share code, notes, and snippets.

from collections import UserList
from functools import partial
from operator import add
# a class that allows a subclass to declare a function to use to handle all protocols
class CustomApplyList(UserList):
def __init__(self, f, args):
super().__init__(args)
self.f = f
@llimllib
llimllib / gif_tidbyt.sh
Last active April 15, 2023 02:07
A script to display a gif on a tidbyt (http://tidbyt.com)
#!/usr/bin/env bash
set -euo pipefail
function usage {
cat <<"EOF"
gif.sh [-rv] image.gif
display image.gif on your tidbyt. Assumes you have `pixlet` installed, and that
the device you want to display it on is the first in the list of `pixlet
devices`
# download_all_emoji.py: A script to query the slack API for all emojis on a
# given instance, and then download them into an "emojis" folder
#
# USAGE
#
# first, set a `SLACK_TOKEN` environment variable to a token that has
# `emoji:read` permission. Then, run this script with
# `python download_all_emoji.py`.
#
# it does not run in parallel, so it may take a while. Are you really
@llimllib
llimllib / gpt.sh
Last active December 31, 2023 10:54
a bash function to return gpt results. Now improved and made into a full repo: https://github.com/llimllib/gpt-bash-cli
#!/usr/bin/env bash
#
# Installation (OS X):
#
# - save this file as "gpt" somewhere in your path
# - get an openai api key at: https://platform.openai.com/account/api-keys
# - save the openai api key to your keychain with:
# security add-generic-password -s 'openai' -a '<account name>' -w '<api key>'
# - If you don't already have `jq`, install it with `brew install jq` or whatever
#
@llimllib
llimllib / install.sh
Last active March 4, 2024 12:03
The script I use to set up a new mac just the way I like it
#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# instructions on finding the default you've changed: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
# https://gist.github.com/llimllib/3fc4fefcfc0152dad8c58201246d8802
#
# this script's URL is: https://gist.github.com/llimllib/c4dd0a98a426022b0365d4c0a9090460
@llimllib
llimllib / install.sh
Last active November 9, 2022 19:44
install and setup a mac exactly as I like it, in as automated a way as possible
#!/usr/bin/env bash
# many settings from https://raw.githubusercontent.com/mathiasbynens/dotfiles/master/.macos
# many settings from https://raw.githubusercontent.com/thoughtbot/laptop/master/mac
# instructions on finding the default you've changed: https://pawelgrzybek.com/change-macos-user-preferences-via-command-line/
# previous install notes at:
# https://gist.github.com/llimllib/ee591266e05bd880629a4e7511a61bb3
# https://gist.github.com/llimllib/e864a92da94ceb1ef0da2e06fd1f8d70
# https://gist.github.com/llimllib/3fc4fefcfc0152dad8c58201246d8802
fancy_echo() {
#include <stdio.h>
#include <stdarg.h>
// https://github.com/nothings/stb
#define STB_DS_IMPLEMENTATION
#include "stb_ds.h"
// compile with: gcc -Wall -I . dabeaz_stb.c -o a && ./a
typedef struct datum datum;
$ raco pkg install scribble
Resolving "scribble" via https://download.racket-lang.org/releases/8.5/catalog/
Downloading https://download.racket-lang.org/releases/8.5/pkgs/scribble.zip
The following uninstalled packages are listed as dependencies of scribble:
scribble-lib
scribble-doc
Would you like to install these dependencies? [Y/n/a/c/?]
00: Resolving "scribble-lib" via https://download.racket-lang.org/releases/8.5/catalog/
Resolving "scribble-doc" via https://download.racket-lang.org/releases/8.5/catalog/
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin()
Plug 'neovim/nvim-lspconfig'
Plug 'hrsh7th/cmp-nvim-lsp'
Plug 'hrsh7th/cmp-buffer'