Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python3
import struct
import sys
import operator
dirent = struct.Struct("<II")
def getEntities(fd):
fd.seek(8)
@therealmik
therealmik / sftpput
Created June 4, 2015 06:14
For when you just want to dump some data on a remote sftp server
#!/usr/bin/python
BUFSIZE=4096
import sys
import paramiko
import re
def parse_url(urlstr):
urlre = re.compile("^(([^@:]+)@)?([^:]+):(.*)$")
@therealmik
therealmik / gist:33b10e169b47fdb7d126
Last active August 29, 2015 14:14
Notes on the DTCA Consultation session (Melbourne)

These are just notes on what pieces of information I picked up from the session, not legal advice or even necessarily correct.

The consultation was for an amendment, which specifically adds exceptions for Australian law enforcement and defence agencies operating overseas (whoops!). It also trys to soften the blow for "publishing".

If you deal with "Section 1" goods (military stuff), you belong to DoD now. But you did before, so now you have to fill in another form for each project you do.

  • "Publishing": If you make the knowledge available to anyone (payment or otherwise)
@therealmik
therealmik / gist:9907580
Last active August 29, 2015 13:57
Simple byte frequency count
#!/usr/bin/python3
import numpy
import sys
def analyse(fd):
result = numpy.zeros(256, dtype=numpy.uint32)
while True:
data = fd.read(4096)