Skip to content

Instantly share code, notes, and snippets.

@toshism
toshism / mkvenv.sh
Last active December 14, 2023 14:02
Small script to quickly setup new python environments using pyenv and direnv.
#!/usr/bin/env bash
envrc=$(cat << EOF
if [ -z "\${VENV_BASE:-}" ] && [ -n "\${VIRTUAL_ENV:-}" ]; then
VENV_BASE=\$(basename "\${VIRTUAL_ENV}")
fi
export VENV_BASE
unset PS1
EOF
)

Keybase proof

I hereby claim:

  • I am toshism on github.
  • I am toshism (https://keybase.io/toshism) on keybase.
  • I have a public key ASB71tf-SniAQZLSdu35cyNfu52QJgB_6p54P0mY8BRNaAo

To claim this, I am signing this object:

@toshism
toshism / .vimrc
Created June 24, 2015 16:09
basic .vimrc I use this on servers and what not. Nice and simple.
" Be more Vimmy.
set nocompatible
" Encode all files in UTF-8 by default.
set encoding=utf-8
" Turn on syntax highlighting.
syntax enable
set background=dark
@toshism
toshism / tmux.conf
Last active February 8, 2016 19:24
tmux configuration
# ~/.tmux.conf
set -g default-terminal "screen-256color"
set-window-option -g mode-keys emacs
# start window numbers at 1. 0 is so far over there
set -g base-index 1
set-window-option -g pane-base-index 1
@toshism
toshism / gist:8966942
Created February 12, 2014 23:47
Custom manager on base class
class AwesomeCustomManager(models.Manager):
def get_query_set(self):
return SuperAwesomeQuerySet(self.model)
def __getattr__(self, attr):
if attr.startswith('__'):
raise AttributeError("%r object has no attribute %r" %
(self.__class__, attr))
return getattr(self.get_query_set(), attr)
@toshism
toshism / .tmux.conf
Created January 14, 2013 19:45
My .tmux.conf file
set -g default-terminal "screen-256color"
set-window-option -g mode-keys emacs
# start window numbers at 1. 0 is so far over there
set -g base-index 1
# set prefix to C-j instead of C-b
unbind C-b
set-option -g prefix C-j
@toshism
toshism / pls_play.sh
Created May 1, 2012 21:01
Simple shell script to play pls files on the command line
#!/bin/bash
# you can of course change mpg123 to mplayer or whatever you prefer
cat "$1" | grep -e '^File1' | cut -f 2 -d = | xargs mpg123
@toshism
toshism / gist:1571984
Created January 6, 2012 19:20
django split datetime fields
#models.py
class Activity(models.Model):
name = models.CharField()
start = models.DateTimeField()
end = models.DateTimeField()
#forms.py
@toshism
toshism / file1.el
Created January 6, 2012 19:09
quick point to register
(global-set-key (kbd "C-c ;") '(lambda () (interactive) (point-to-register ?1)))
(global-set-key (kbd "C-c [") '(lambda () (interactive) (jump-to-register ?1)))