Skip to content

Instantly share code, notes, and snippets.

@er2
er2 / PS1
Created May 27, 2015 17:52
My $PS1
# Ubuntu default coloring and git current branch
# prefix with
# `source ~/.git-prompt.sh`
# in .bashrc
PS1='\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\W$(__git_ps1 " (%s)")\[\033[00m\]\\$ '
@er2
er2 / getAst.p6
Created March 27, 2016 22:42
get perl 6 ast
use Perl6::Grammar;
my $input = slurp @*ARGS[0].IO;
# say $input;
my $ast = Perl6::Grammar.parse($input).ast;
@er2
er2 / fitnesse.service
Created June 22, 2016 13:09
A systemd unit file for running FitNesse as a service
[Unit]
Description=Fitnesse
[Service]
Type=idle
User=fitnesse
WorkingDirectory=/home/fitnesse/fitnesse
Environment=CM_SYSTEM=fitnesse.wiki.cmSystems.GitCmSystem
ExecStart=/usr/bin/authbind --deep /usr/bin/java -jar /opt/fitnesse/fitnesse-standalone.jar -p 80 -v
ExecStop=/usr/bin/wget -qO- http://localhost/?responder=shutdown &> /dev/null
use experimental :cached;
sub MAIN(Int $nth) {
say fib($nth);
}
sub fib(Int $nth) is cached {
given $nth {
when 0 { 0 }
when 1 { 1 }
@er2
er2 / expressive.p6
Last active December 19, 2020 20:05
I saw this Expressive C++17 challenge going around and felt like solving it in Perl 6
sub MAIN($input, Str $column, Str $replacement, IO::Path $output="output.csv".IO) {
my Str $headings = $input.IO.lines[0];
my $index = $headings.split(",").antipairs.hash{$column};
die "column $column not found" unless $index ~~ Int:D;
my $fh = open $output, :w;
LEAVE close $fh;
for $input.IO.lines.skip: 1 -> $line {
my @arr = $line.split(",");
@arr[$index] = $replacement;
$fh.say(@arr.join(","));
@er2
er2 / .vimrc
Created February 28, 2018 22:21
vim rc
:set hlsearch
@er2
er2 / gist:f64b87ef6ef755e52bf1f725d33a11b2
Created March 14, 2018 01:44
zef install Bailador error
~ § zef install Bailador
===> Searching for: Bailador
===> Searching for missing dependencies: Digest, Digest::HMAC, File::Directory::Tree, File::Find, File::Temp, HTTP::Easy, HTTP::MultiPartParser, HTTP::Server::Ogre, HTTP::Status, JSON::Fast, Log::Any, Path::Iterator, Template::Mojo, Template::Mustache, Terminal::ANSIColor, URI, URI::Encode, YAMLish, TAP::Harness
===> Failed to find dependencies: JSON::Fast
Failed to find some required dependencies
in block at /home/eric/.perl6/sources/2158CAEE45BB3EB1F5F1FF1966AC2618E239BB0E (Zef::Client) line 142
in block at /home/eric/.perl6/sources/2158CAEE45BB3EB1F5F1FF1966AC2618E239BB0E (Zef::Client) line 100
in sub MAIN at /home/eric/.perl6/sources/C3F65247E0A89E0FCF1E5C13DD914D1A69A261D3 (Zef::CLI) line 124
in block <unit> at /home/eric/.perl6/resources/2908F54AD8E3D544B2A57336ACCC3F23924D645C line 1
~ § zef --force install zef
===> Searching for: zef
===> Testing: zef:ver('0.2.3'):auth('github:ugexe')
===> Testing [OK] for zef:ver('0.2.3'):auth('github:ugexe')
===> Installing: zef:ver('0.2.3'):auth('github:ugexe')
===> Install [FAIL] for zef:ver('0.2.3'):auth('github:ugexe'): Failed to open file /home/eric/.zef/store/zef.git/5eeae20d9d2d00f1ea9cc613f4b41711ad055043/resources/config.json scripts/perl5tar.pl scripts/win32http.ps1 scripts/win32unzip.ps1: No such file or directory
Failed to open file /home/eric/.zef/store/zef.git/5eeae20d9d2d00f1ea9cc613f4b41711ad055043/resources/config.json scripts/perl5tar.pl scripts/win32http.ps1 scripts/win32unzip.ps1: No such file or directory
in block at /home/eric/.perl6/sources/2158CAEE45BB3EB1F5F1FF1966AC2618E239BB0E (Zef::Client) line 556
in block at /home/eric/.perl6/sources/2158CAEE45BB3EB1F5F1FF1966AC2618E239BB0E (Zef::Client) line 519
in sub at /home/eric/.perl6/sources/2158CAEE45BB3EB1F5F1FF1966AC2618E239BB0E (Zef::Client) line 508
@er2
er2 / recent-branches.fish
Created May 8, 2018 12:45
~/.config/fish/functions/recent-branches.fish
function recent-branches
git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:yellow)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:blue)%(subject)|%(color:magenta)%(authorname)%(color:reset)' | column -ts'|' $argv;
end
@er2
er2 / setup.md
Last active July 7, 2024 20:34
Linux setup

grub-btrfs + snapper or timeshift

  • fonts-noto unifont # fonts with lots of international and obscure unicode characters
  • ttf-inconsolata
  • fish
  • guake
    • gnome settings shortcut
  • bitwarden
  • yay
  • set scaling ratio in Gnome Tweaks, not display settings