Skip to content

Instantly share code, notes, and snippets.

@dbohdan
dbohdan / Zsh: change directory using ranger
Created August 17, 2013 16:15
Adopted from the "Bash: cd to last path after exit" example in the man page for ranger(1).
ranger-cd() {
tempfile=$(mktemp)
ranger --choosedir="$tempfile" "${@:-$(pwd)}" < $TTY
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd -- "$(cat "$tempfile")"
fi
rm -f -- "$tempfile"
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dbohdan
dbohdan / f-sharp-fedora-21.sh
Last active April 17, 2016 11:05
Install F# and Mono 4.0 on Fedora 21
#!/bin/sh
set -e
# Repo info: https://lists.fedoraproject.org/pipermail/fedora-mono/2013-November/000466.html
curl http://download.opensuse.org/repositories/home:/tpokorra:/mono/Fedora_21/home:tpokorra:mono.repo | sudo tee /etc/yum.repos.d/mono.repo
sudo dnf install -y mono-opt mono-opt-devel
git clone https://github.com/fsharp/fsharp
cd fsharp
export PATH=$PATH:/opt/mono/bin
export PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig
@dbohdan
dbohdan / grades.tcl
Last active July 23, 2021 09:30 — forked from smls/grades.p6
Data munging task from the Perl 6 advent calendar
#!/usr/bin/env tclsh
package require sqlite3
package require fileutil
sqlite3 db :memory:
db eval {CREATE TABLE grades(name TEXT PRIMARY KEY, grade TEXT)}
foreach {name grade} [::fileutil::cat grades.txt] {
if {![regexp {[A-F][+-]?} $grade]} {
@dbohdan
dbohdan / decoder.tcl
Last active August 29, 2015 14:17
Go Challenge 1 in Tcl
#!/usr/bin/env tclsh
package require fileutil
namespace eval ::decoder {
# Allow us to use +, -, *, /, etc. as commands outside of the [expr] DSL.
namespace path ::tcl::mathop
}
proc ::decoder::decode-file {filename} {
# Read the entire file into memory as binary. [::fileutil::cat] runs the
@dbohdan
dbohdan / tmux-cheatsheet.markdown
Last active September 21, 2015 19:04 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname