Skip to content

Instantly share code, notes, and snippets.

@iamFIREcracker
iamFIREcracker / linux-setup.sh
Created March 27, 2024 13:55 — forked from dhh/linux-setup.sh
linux-setup.sh
# CLI
sudo apt update
sudp apt install \
git curl docker.io \
build-essential pkg-config autoconf bison rustc cargo clang \
libssl-dev libreadline-dev zlib1g-dev libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libjemalloc2 \
libvips imagemagick libmagickwand-dev libsqlite3-0 \
redis-server mysql-server sqlite3 libmysqlclient-dev apache2-utils \
rbenv
@iamFIREcracker
iamFIREcracker / path.md
Created February 10, 2024 15:38 — forked from romainl/path.md
Off the beaten path

Off the beaten path

What is &path used for?

Vim uses :help 'path' to define the root directories from where to search non-recursively for files.

It is used for:

  • gf, gF, <C-w>f, <C-w>F, <C-w>gf, <C-w>gF,
  • :find, :sfind, :tabfind,
@iamFIREcracker
iamFIREcracker / lisp.vim
Last active February 13, 2022 18:46
Lisp / Vim: highlight surrounding expression
augroup vlime_hilight_curr_expr
autocmd!
if empty(prop_type_get('lisp_curr_expr'))
call prop_type_add('lisp_curr_expr', {'highlight': 'LispCurrExpr'})
endif
hi link LispCurrExpr MatchParen
function! s:HilightCurrExpr() abort
call prop_remove({'type': 'lisp_curr_expr', 'all': v:true})
@iamFIREcracker
iamFIREcracker / roswell-install-for-ci.sh
Last active November 7, 2019 18:43
Script to get roswell installed on the build box -- it works on Linux, Mac OS, and Windows
#!/usr/bin/env sh
ROSWELL_URL=https://github.com/roswell/roswell/releases/download/v19.09.12.102/roswell_19.09.12.102_amd64.zip
OS_WIN=$(uname -s | grep -e MSYS_NT)
if [ -n "$OS_WIN" ]; then
ROSWELL_IN_PATH=$(echo $PATH | grep -F /tmp/roswell)
if [ -z "$ROSWELL_IN_PATH" ] ; then
echo "/tmp/roswell not found \$PATH"
exit 1
@iamFIREcracker
iamFIREcracker / backoff.py
Created October 15, 2017 17:00
Python decorator to recover from failed function calls
#!/usr/bin/env python
"""Script showing how to use decorators to recover from failed function calls
"""
import sys
import time
def backoff1(step):
def wrapper1(func):
function tail_from() {
tail -n 0 -f $2 > /tmp/tail_from.$$ &
tac $2 | sed "/$1/q" | tac | sed '/^$/d'
tail -c +1 -f /tmp/tail_from.$$
kill %%
rm /tmp/tail_from.$$
}
#!/usr/bin/env bash
# Utility script which creates and display a QR code with the content of
# positional arguments or with everything stored within the WM clipboard.
#
# Depends on xclip, curl and xdg-open
set -e
TEMP=""
@iamFIREcracker
iamFIREcracker / ternary_search.py
Created October 30, 2012 06:46
Ternary Search in Python
#!/usr/bin/env python
# -*- coding: utf-8
"""
This is a module which exports functions implementing the ternary search
algorithm:
http://en.wikipedia.org/wiki/Ternary_search
In particular the module exports functions to minimize/maximize a given function
@iamFIREcracker
iamFIREcracker / browser
Created October 28, 2012 10:59 — forked from defunkt/browser
pipe html to a browser
#!/bin/bash -e
#
# Usage: browser
# pipe html to a browser
# e.g.
# $ echo '<h1>hi mom!</h1>' | browser
# $ ron -5 man/rip.5.ron | browser
OPEN=xdg-open
if [ -t 0 ]; then
@iamFIREcracker
iamFIREcracker / ternary_search.py
Created August 3, 2012 07:04
Python implementation of the ternary search algorithm
#!/usr/bin/env python
from __future__ import print_function
from __future__ import division
def maximize(func, a, b, precision):
(left, right) = (a, b)
while True:
if right - left <= precision: