Code now located at:
https://github.com/dansimau/pystringattr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import csv | |
tsvin = csv.reader(sys.stdin, dialect=csv.excel_tab) | |
csvout = csv.writer(sys.stdout, dialect=csv.excel) | |
for row in tsvin: | |
# Force all fields to be string-based (Excel specific) | |
for i, val in enumerate(row): | |
row[i] = '="%s"' % val | |
csvout.writerow(row) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Get last argument as the base filename | |
file=${!#} | |
if [ "$file" == "--version" ]; then | |
python --version | |
exit $? | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DirtyBase(object): | |
def __init__(self, *a, **k): | |
super(DirtyBase, self).__init__(*a, **k) | |
self.dirty = False | |
def __setitem__(self, *a, **k): | |
self.mark_dirty() | |
super(DirtyBase, self).__setitem__(*a, **k) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Helper script to quickly fix merge conflicts. | |
# | |
# dan@dans.im | |
# 2014-02-05 | |
# | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Copyright (c) 2016 Daniel Simmons | |
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: | |
The above copyright notice and this permission notice shall be included in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo | |
type FooInterface interface { | |
FooFunc() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Same as `go get` but you can specify a git commit ref. | |
# | |
set -e | |
# | |
# Resolve the path to the Go workspace from GOPATH. | |
# | |
_go_workspace() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set the RGB16bit_list to (choose color) | |
-- convert choosen color to HEX | |
set the formatedColor to my RBG_to_HEX(RGB16bit_list) | |
set the clipboard to formatedColor | |
display dialog "HEX colour value (" & formatedColor & ") has been copied to the clipboard." with icon 1 buttons {"Dismiss"} default button {"Dismiss"} giving up after 10 | |
on RBG_to_HEX(RGB_values) | |
-- this subroutine was taken from "http://www.apple.com/applescript/sbrt/sbrt-04.html" | |
set the hex_list to {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Runs `go test -v`, parses the output and only displays errors. Also displays | |
# a summary of tests passed/failed/skipped/etc. | |
# | |
set -o pipefail | |
declare buffer= | |
declare test_error=false |