Skip to content

Instantly share code, notes, and snippets.

@zyocum
zyocum / starship.toml
Created December 21, 2022 23:07
Zach's `starship.toml`
# some symbols used in this config require custom fonts or additional software
# for nerd font symobls see: https://www.nerdfonts.com/cheat-sheet
# for Apple SF symbols (macOS only) see: https://developer.apple.com/sf-symbols/
# Don't print a new line at the start of the prompt
add_newline = false
format = """\
$username\
$hostname\
@zyocum
zyocum / starship.toml
Created September 4, 2022 14:38
Custom starship config
# Don't print a new line at the start of the prompt
add_newline = false
# for nerd font symobls see: https://www.nerdfonts.com/cheat-sheet
format = """\
$username\
$hostname\
$directory\
$read_only\
@zyocum
zyocum / simple.toml
Created September 4, 2022 14:36
Simple macchina theme
#colo for a complete reference, visit
# https://github.com/Macchina-CLI/macchina/wiki/Theme-Documentation
hide_ascii = true
prefer_small_ascii = true
spacing = 1
padding = 0
separator = "❯"
key_color = "Magenta"
separator_color = "LightMagenta"
@zyocum
zyocum / cup_surface_area.html
Last active July 1, 2021 16:06
surface_area_of_cup
<meta charset="utf-8" emacsmode="-*- markdown -*">
**Surface Area of a Cup with a Straight Outer Edge**
Let's say our cup is defined by the following parameters:
\begin{align*}
r=\,&\text{radius of the top of the cup}\\
b=\,&\text{height of the cup}\\
B=\,&\text{angle of the sloped side of the cup}\\
\end{align*}
@zyocum
zyocum / mailcap
Created July 29, 2020 17:09
Custom Terminal UI for Reddit mailcap for macOS
# Example mailcap file for Terminal UI for Reddit
# https://gitlab.com/ajak/tuir/
#
# Copy the contents of this file to {HOME}/.mailcap, or point to it using $MAILCAPS
# Then launch TUIR using the --enable-media flag. All shell commands defined in
# this file depend on external programs that must be installed on your system.
#
# HELP REQUESTED! If you come up with your own commands (especially for OS X)
# and would like to share, please post an issue on the GitHub tracker and we
# can get them added to this file as references.
#!/usr/bin/env python3
from itertools import chain
from itertools import combinations
import numpy as np
def distances(sentence, window=3, scale=True):
"""Compute a dictionary mapping combinations of pairs of words in the sentence to their normalized distances.
s1 = 'A B X B'.split()
$ curl -sX POST -H "X-RosetteAPI-Key: $ROSETTE_USER_KEY" -H "Content-Type: application/json" -H "Accept: application/json" -d '{"content":"Salesforce.com, Inc. is an American cloud-based software company headquartered in San Francisco."}' 'https://api.rosette.com/rest/v1/entities?output=rosette' | jq .
{
"version": "1.1.0",
"data": "Salesforce.com, Inc. is an American cloud-based software company headquartered in San Francisco.",
"attributes": {
"scriptRegion": {
"type": "list",
"itemType": "scriptRegion",
"items": [
{
#!/usr/bin/env python3
"""Produce visual, HTML diffs of two files"""
from argparse import ArgumentError, FileType
from difflib import HtmlDiff
def load(filename):
with open(filename, mode='r') as f:
for line in f:
@zyocum
zyocum / corncob-isograms.txt
Last active February 7, 2020 03:19
List of isograms (words that contain only one instance of each letter they contain).
abdomen
abdomens
abduct
abducting
abduction
abductions
abductor
abductors
abducts
abe
@zyocum
zyocum / results.md
Created January 17, 2020 22:37
huniq benchmark results
mode repeats impl results
uniq 1 rust real 0.17
uniq 1 rust user 0.15
uniq 1 rust sys 0.01
uniq 1 rust 39809024 maximum resident set size
uniq 1 cpp real 0.37
uniq 1 cpp user 0.35
uniq 1 cpp sys 0.01
uniq 1 cpp 19337216 maximum resident set size