Skip to content

Instantly share code, notes, and snippets.

Avatar
👶
dad life

Robert Pearce rpearce

👶
dad life
View GitHub Profile
@rpearce
rpearce / retry
Last active Jan 19, 2023
Bash script for retrying commands
View retry
#!/usr/bin/env bash
set -o errexit
#set -o errtrace
set -o nounset
#set -eou pipefail
# ==============================================================================
VERSION="0.1.0"
@rpearce
rpearce / bash_args_parsing_template
Last active Jan 19, 2023
Bash argument parsing program template
View bash_args_parsing_template
#!/bin/bash
set -o errexit
set -o errtrace
set -o nounset
set -eou pipefail
# ==============================================================================
VERSION="0.1.0"
@rpearce
rpearce / xmas-sam
Created Dec 9, 2022
Xmas present for a great brother in-law
View xmas-sam
#!/bin/bash
set -o errexit
set -o errtrace
set -o nounset
set -eou pipefail
# ==============================================================================
function clearscreen {
@rpearce
rpearce / flake.nix
Created Jun 19, 2021
IHP Web Framework Nix Flake
View flake.nix
{
description = "IHP flake";
nixConfig.bash-prompt = "[nix]\\e\[38;5;172mλ \\e\[m";
inputs = {
nixpkgs.url = "nixpkgs/nixos-21.05";
flake-utils = {
url = "github:numtide/flake-utils";
@rpearce
rpearce / .ghci
Last active Oct 19, 2022
Flake for using Haskell in nix develop
View .ghci
:def hoogle \x -> return $ ":!hoogle --count=15 \"" ++ x ++ "\""
:def doc \x -> return $ ":!hoogle --info \"" ++ x ++ "\""
:set -Wall
:set -fno-warn-type-defaults -ferror-spans -freverse-errors -fprint-expanded-synonyms
:set prompt "\ESC[0;32m%s\n\ESC[m[ghci]\ESC[38;5;172mλ \ESC[m"
:set prompt-cont " \ESC[38;5;172m> \ESC[m"
@rpearce
rpearce / lightenDarkenHex.js
Created Mar 31, 2021
Ligthen Darken Hex Colors
View lightenDarkenHex.js
// helper functions are from https://github.com/rpearce/hex
const lightenDarken = (direction, color) => {
const rgb = hexToRgba(color).slice(0, 3)
// algo from https://stackoverflow.com/a/21038522/680394
const rgbAdjusted = direction >= 0
? rgb.map(x => (1 - direction) * x + direction * 255)
: rgb.map(x => (1 + direction) * x)
@rpearce
rpearce / bday-kp.sh
Last active Dec 9, 2022
bday text game gift for my sister
View bday-kp.sh
#!/usr/bin/env bash
set -o errexit
set -o errtrace
set -o nounset
set -eou pipefail
function clearscreen {
printf '\033c'
}
@rpearce
rpearce / tmp.rb
Created Apr 10, 2017
Rails – open a file, read it and write it to a temp file
View tmp.rb
module Tmp
def self.build(src:, name:, ext:, binmode: false)
file = Tempfile.new([name, ext], Rails.root.join('tmp'))
file.binmode if binmode
open(src) { |f| file.write(f.read) }
file.rewind
file.close
file
end
end
View install-script--temp-computer.sh
#!/bin/sh
###############################################################################
# XCode
###############################################################################
echo "Setting up XCode..."
xcodebuild -license
xcode-select --install
sudo xcode-select -switch /Library/Developer/CommandLineTools
View keybase.md

Keybase proof

I hereby claim:

  • I am rpearce on github.
  • I am rpearce (https://keybase.io/rpearce) on keybase.
  • I have a public key whose fingerprint is 6F5D 52E9 DEF3 D210 66AE 97F4 E8DD 20E4 8EFB 46B5

To claim this, I am signing this object: