Skip to content

Instantly share code, notes, and snippets.

View timabell's full-sized avatar
🍵
418 I'm a teapot

Tim Abell timabell

🍵
418 I'm a teapot
View GitHub Profile
@timabell
timabell / fix-metro.sh
Created April 3, 2018 19:43
metro bank export to ynab import converter
#!/bin/bash
IFS='\n'
for x in *.csv; do
echo "$x"
cp "$x" "$x.orig"
sed -i '1c Date,Payee,Memo,Money In, Money Out,Balance' "$x"
# remove stupid date from start of tx description. fucking idiots.
sed -i 's/,[0-9][0-9] [A-Z][A-Z][A-Z] [0-9][0-9] /,/g' "$x"
done
#!/bin/bash -v
# backing up a vm
cd /media/tim/WD6/
base="/home/tim/VirtualBox VMs"
src=win10-2018
mv $src.tar.lz4 $src.tar.lz4.old
@timabell
timabell / LICENSE
Last active February 27, 2017 16:25
azure dev vm base
The MIT License (MIT)
Copyright (c) 2015 Microsoft Azure
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@timabell
timabell / profile.ps1
Last active May 1, 2018 08:17
my powershell customisations
# customized per-user profile
# https://gist.github.com/timabell/56254968905f9066ef88c1ae774a53d1
# don't forget to start a new powershell after editing this
# useful things:
# install https://github.com/neilpa/cmd-colors-solarized
# regedit /s solarized-light.reg
# install https://github.com/dahlbyk/posh-git
# Install-Module posh-git # requires PSGet
# output all the colour combinations for text/background
# https://stackoverflow.com/questions/20541456/list-of-all-colors-available-for-powershell/41954792#41954792
$colors = [enum]::GetValues([System.ConsoleColor])
Foreach ($bgcolor in $colors){
Foreach ($fgcolor in $colors) { Write-Host "$fgcolor|" -ForegroundColor $fgcolor -BackgroundColor $bgcolor -NoNewLine }
Write-Host " on $bgcolor"
}
# boxstarter script http://boxstarter.org/
# source: https://gist.github.com/timabell/14c15666fa58d3db66aa3411d243967e
# based on: https://gist.github.com/timabell/608fb680bfc920f372ac
# tested on win10 x64
# This is a start of a build of a box I'm using at the moment.
# Fork this to your own gist, then comment/uncomment/add stuff to suit you.
# This for a win 10 machine where development will be done in Hyper-V VMs so
# there's no need for dev tools.
@timabell
timabell / sql layout example.sql
Last active October 26, 2016 11:21
laying out sql nicely with vim tabularize - https://www.flickr.com/photos/tim_abell/30278239000/
-- Before. Note the tab characters in between the "columns" that we want in the sql text.
-- The tabs have been manually added to tell vim where we want to line things up
-- `:set list` to see tabs in vim
create table HandCraftedSqlTable (
id int identity (1, 1) not null,
parentid int not null,
somename varchar(10) not null,
someothername varchar(65) not null,
somestatus int not null constraint DF_table_tabletatusID default (1),
somereallylongcolumnname varchar(255) null,
@timabell
timabell / extended_attributes.sql
Created October 6, 2016 09:35
source-controllable self-enforcing extended attribute list for sql server
-- Permanent copy of schema extended properties
-- In a format suitable for easy source control and hand-editing.
-- All the properties are prefixed and only those will be added/updated/deleted by this script
-- At the bottom you'll find a commented-out `select` for generating the
-- insert block from an existing schema's extended properties.
// method to add to dbcontext
/// <summary>
/// Set EF's OriginalValue of RowVersion for 'entity' to the supplied value.
/// This allows you to make use of EF's built-in concurrent-editing
/// when you don't have the entity as it was presented to the user to
/// edit (because of the stateless nature of the web).
/// Call this before SaveChanges to ensure concurrent edits don't go
/// unnoticed by users.
/// More info: http://stackoverflow.com/a/9190378/10245
@timabell
timabell / cull-remote-branches.sh
Last active July 16, 2016 07:54
delete all but the specified branches on the remote, useful after a github fork of a repo with many branches you don't care about
git branch -r |grep timabell| egrep -v "master|gh-pages|things|to|leave"| sed 's/.*\// :/'|xargs git push timabell