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
fileName = 'test.txt' | |
folder = '/home/me/testDirectory' | |
fileName = folder + '/' + fileName | |
f = File.new(fileName, 'wb+') | |
f.write(attachment[:body]) | |
f.close |
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
git submodule add [email protected]:$mycompany/$myrepo.git | |
Cloning into 'go'... | |
Enter passphrase for key '/home/$me/.ssh/id_rsa': | |
remote: Counting objects: 21, done. | |
remote: Compressing objects: 100% (17/17), done. | |
remote: Total 21 (delta 1), reused 21 (delta 1) | |
Receiving objects: 100% (21/21), 6.37 KiB, done. | |
Resolving deltas: 100% (1/1), done. | |
fatal: You are on a branch yet to be born | |
Unable to checkout submodule '$myrepo' |
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
func find_paths_in_ranges(match_ranges []*matchRange) []Path { | |
var ( | |
paths = make([]Path, len(ranges)) | |
path Path | |
i, j int | |
row *csvm.Row | |
match_range *matchRange | |
) | |
for i, match_range = range ranges { |
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
def will_break(f): | |
broken = False | |
def on_call(self, *args, **kwargs): | |
if broken: | |
raise ValueError("Already broken!") | |
else: | |
broken = True | |
f(self, *args, **kwargs) | |
return on_call |
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 | |
try: | |
raise ValueError("Damn") | |
except ValueError as e: | |
_, _, exc_tb = sys.exc_info() | |
# print the file that threw the exception | |
print(exc_tb.tb_frame.f_code.co_filename) | |
# print the line number of the expression that threw the exception | |
print(exc_tb.tb_lineno) |
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
for the next time a technocrat faffs on about how everything would be ok If People Just Respected Statistics And Data: | |
Through the state's statistical fetishism, a de-contextualised and dated | |
statistic derived from vague sources comes to represent reality. Zombie-like, | |
this statisic rises from the grave, consuming hunters, fishers and gatherers | |
and their bush foods along with entire outstations so that they can no longer | |
be seen by the state. Fetishised, it gains a magical power over other evidence | |
that either challenges or contextualises it. It also gains a power over | |
Indigenous communities, as this statistical abstraction becomes a means for | |
creting their reality rather than merely representing it. It is used as |
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
$ ln -s test.php foo.php | |
$ php test.php | |
/home/vagrant/test.php | |
$ php foo.php | |
/home/vagrant/foo.php |
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
validate: (attrs, options) -> | |
missing = [attr for attr in required if attrs[attr] is null] | |
if missing.length > 0 | |
return "Missing #{missing.join(', ')}" |
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
$ hg summary | |
parent: 16840:414057ac1f1f go1.1.2 release | |
go1.1.2 | |
branch: release-branch.go1.1 | |
commit: (clean) | |
update: (current) | |
$ clang -v | |
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) | |
Target: x86_64-apple-darwin13.0.0 | |
Thread model: posix |
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
type OID []uint32 | |
// Create a new OID | |
func NewOID(num ...uint32) OID { | |
return num | |
} | |
// Create an OID from the C representation | |
func NewOIDFromCArray(coid *C.oid, oid_length C.int) (OID, error) { | |
// See http://stackoverflow.com/questions/14826319/go-cgo-how-do-you-use-a-c-array-passed-as-a-pointer |
OlderNewer