Skip to content

Instantly share code, notes, and snippets.

@dbohdan
dbohdan / tmux-cheatsheet.markdown
Last active Sep 21, 2015 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@dbohdan
dbohdan / decoder.tcl
Last active Aug 29, 2015
Go Challenge 1 in Tcl
View decoder.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 / grades.tcl
Last active Jul 23, 2021 — forked from smls/grades.p6
Data munging task from the Perl 6 advent calendar
View grades.tcl
#!/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 / f-sharp-fedora-21.sh
Last active Apr 17, 2016
Install F# and Mono 4.0 on Fedora 21
View f-sharp-fedora-21.sh
#!/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
View logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@dbohdan
dbohdan / Zsh: change directory using ranger
Created Aug 17, 2013
Adopted from the "Bash: cd to last path after exit" example in the man page for ranger(1).
View Zsh: change directory using ranger
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"
}