Skip to content

Instantly share code, notes, and snippets.

View tylerw's full-sized avatar

Tyler Wardhaugh tylerw

  • Capital Rx
View GitHub Profile
@varenc
varenc / _ugrep
Created May 10, 2023 22:36
ugrep zsh completion automatically generated
#compdef ugrep
# zsh completions for 'ugrep'
# automatically generated with http://github.com/RobSis/zsh-completion-generator
local arguments
arguments=(
{-A,--after-context}'[output NUM lines of trailing context after matching lines. Places]'
{-a,--text}'[process a binary file as if it were text. This is equivalent to]'
'--and[PATTERN ... -e PATTERN]'
@borkdude
borkdude / bipe
Last active April 9, 2024 21:21
vipe for babashka - see https://github.com/juliangruber/vipe
#!/usr/bin/env bash
# temp file
t=/tmp/bipe.$$.txt
touch $t
# read from stdin
if [ ! -t 0 ]; then
cat > $t
@wportercaprx
wportercaprx / toggle_jira.js
Last active October 5, 2023 15:25
Toggle Jira ticket right panel bookmarklet
javascript: (function () {
panel = document.querySelector(
"div[data-testid*='.container-right']"
);
if (panel.style.display == "none")
panel.style.removeProperty("display");
else
panel.style.setProperty("display", "none");
})();

ZSH CheatSheet

This is a cheat sheet for how to perform various actions to ZSH, which can be tricky to find on the web as the syntax is not intuitive and it is generally not very well-documented.

Strings

Description Syntax
Get the length of a string ${#VARNAME}
Get a single character ${VARNAME[index]}
@ericnormand
ericnormand / 00_script.clj
Last active January 6, 2024 07:13
Boilerplate for running Clojure as a shebang script
#!/bin/sh
#_(
#_DEPS is same format as deps.edn. Multiline is okay.
DEPS='
{:deps {clj-time {:mvn/version "0.14.2"}}}
'
#_You can put other options here
OPTS='
@bhb
bhb / README.md
Last active May 15, 2023 01:28
Clojure friendly mode, inspired by https://github.com/slipset/friendly
;; try this form-by-form at a REPL
(require '[clojure.spec.alpha :as s])
;; create an inline DSL to describe the FizzBuzz world
(defmacro divides-by
[nm n]
`(s/def ~nm (s/and pos-int? #(zero? (mod % ~n)))))
;; specify FizzBuzz
(divides-by ::fizz 3)
@junegunn
junegunn / ag-change
Last active May 28, 2021 02:13
Restarting source command
#!/usr/bin/env bash
ag_source() {
local query
[ -z "$1" ] && query="^(?=.)" || query="$1"
ag --nogroup --column --color "$query" 2> /dev/null
}
filter() {
local query="$1"
@boogie666
boogie666 / fizzbuzz.clj
Last active December 5, 2017 00:18
Lazy Functional FizzBuzz in Clojure
(ns fizzbuzz.core)
(defn str-max [a b]
(if (<= (compare a b) 0) b a))
(def fizzes (cycle ["" "" "fizz"]))
(def buzzes (cycle ["" "" "" "" "buzz"]))
(def numbers (sequence (comp (map inc) (map str)) (range)))
@riceissa
riceissa / vim-keys.txt
Last active November 1, 2023 12:24
Vim keys table
Legend: 'n' - not used in stock Vim
'y' - used in stock Vim
's' - synonym for something in stock Vim
'c' - key that continues, i.e. waits for another key; if 'showcmd' is
set, these are generally the cases where partial commands appear
on the status bar
The table assumes 'insertmode' and 'allowrevins' are not set.
See also <http://vim.wikia.com/wiki/Unused_keys>.