Skip to content

Instantly share code, notes, and snippets.

View Fingel's full-sized avatar
🏠

Austin Riba Fingel

🏠
View GitHub Profile
@Fingel
Fingel / fish-profile.txt
Created October 31, 2019 18:22
Fish profile
Time Sum Command
1133 5053 > builtin source /usr/local/Cellar/fish/3.0.2/share/fish/config.fish
50 50 -> set -g IFS \n\ \t
23 23 -> set -qg __fish_added_user_paths
19 19 -> set -g __fish_added_user_paths
17 17 -> function __fish_default_command_not_found_handler
printf "fish: Unknown command %s\n" (string escape -- $argv[1]) >&2
...
9 425 -> if status --is-interactive
# The user has seemingly explicitly launched an old fish with too-new scripts installed.
@Fingel
Fingel / .vimrc
Created March 23, 2018 22:14
SImple But Usable Vim Config
" Spaces and indent
set expandtab " tabs are spaces
set shiftwidth=4 " size of indents in spaces
set softtabstop=4 " simulate tabs with this many spaces
" FileType specific tab overrides
filetype plugin indent on " Enable filetype detection and <filetype>.vim loading
autocmd FileType html setlocal shiftwidth=2 tabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2
autocmd FileType vue setlocal shiftwidth=2 tabstop=2
@Fingel
Fingel / latlng2srid.py
Last active December 27, 2017 02:12
Return the SRID corresponding to the UTM zone for a given Latitude and Longtitude in WSG84
"""
Point must be in srid 4326 (Mercator projection)
Based on http://lists.osgeo.org/pipermail/postgis-users/2005-December/010204.html
"""
def point_to_srid(lat, lng):
if lat > 0:
base_srid = 32600 # northern hemisphere
else:
base_srid = 32700
0x7b8c37aE8B1ea33962D6ee08cA912670357092Ff
@Fingel
Fingel / pony.py
Last active August 26, 2016 20:29
A really simple ponysort implementation
import random
"""
My 'probably good enough' implementation of the ponysort.
Create enough buckets (rakes) for each rider. Iterate over the
riders and only add a rider to a rake if it is not already
there. Does not attempt to optimize spacing.
There is a case where the callup can not be created: if a rider
appears more than NUM_RIDERS/RAKE_SIZE times.
@Fingel
Fingel / tmuxtut.md
Created November 13, 2015 17:36
A tmux tutorial

Tmux Tutorial

Tmux stands for Terminal Multiplexer. It allows you to run multiple programs in the same terminal, detach from the terminal (while the programs continue to run) and re attach from a different terminal.

Start Tmux

tmux

@Fingel
Fingel / PGBoxDjangoField.py
Last active October 13, 2015 16:40
A django model field for the postgresql box geometric type
from django.db import models
from ast import literal_eval as make_tuple
from django.core.exceptions import ValidationError
import collections
def parse_tuple(box_tuple):
if len(box_tuple) != 2:
raise ValidationError("Box has exactly two points (NE, SW)")
if not all(isinstance(i, tuple) for i in box_tuple):
@Fingel
Fingel / pyinotifyasyncio.py
Created September 25, 2015 02:10
Using pyinotify with python 3 asyncio
import pyinotify
import asyncio
class EventHandler(pyinotify.ProcessEvent):
def process_IN_CREATE(self, event):
if not event.dir:
print("Got new file: ", event.pathname)
wm = pyinotify.WatchManager() # Watch Manager
@Fingel
Fingel / config.fish
Last active August 29, 2015 14:14
config.fish
set -g __fish_git_prompt_show_informative_status 1
set -g __fish_git_prompt_hide_untrackedfiles 1
set -g __fish_git_prompt_color_branch magenta bold
set -g __fish_git_prompt_showupstream "informative"
set -g __fish_git_prompt_char_upstream_ahead "↑"
set -g __fish_git_prompt_char_upstream_behind "↓"
set -g __fish_git_prompt_char_upstream_prefix ""
set -g __fish_git_prompt_char_stagedstate "●"
@Fingel
Fingel / accuratelocation.js
Last active August 29, 2015 14:11
Getting an Accurate location in javascript
getAccurateCurrentPosition = function (geolocationSuccess, geolocationError, geoprogress, options) {
var lastCheckedPosition,
locationEventCount = 0,
watchID,
timerID;
options = options || {};
var checkLocation = function (position) {
lastCheckedPosition = position;