Skip to content

Instantly share code, notes, and snippets.

@saml
Last active February 21, 2017 17:04
Show Gist options
  • Select an option

  • Save saml/f7b618e35963ea1b225fd25875044600 to your computer and use it in GitHub Desktop.

Select an option

Save saml/f7b618e35963ea1b225fd25875044600 to your computer and use it in GitHub Desktop.
a.pbm:
1000000000000000
1100000000000000
1110000000000000
1111000000000000
1111100000000000
1111110000000000
1111111000000000
1111111100000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
0000000000000000
$ xxd -b -c2 a.out
0000000: 11111110 11111111 ..
0000002: 11111100 11111111 ..
0000004: 11111000 11111111 ..
0000006: 11110000 11111111 ..
0000008: 11100000 11111111 ..
000000a: 11000000 11111111 ..
000000c: 10000000 11111111 ..
000000e: 00000000 11111111 ..
0000010: 11111111 11111111 ..
0000012: 11111111 11111111 ..
0000014: 11111111 11111111 ..
0000016: 11111111 11111111 ..
0000018: 11111111 11111111 ..
000001a: 11111111 11111111 ..
000001c: 11111111 11111111 ..
000001e: 11111111 11111111 ..
In [30]: base64.b64decode('/v/8//j/8P/g/8D/gP8A//////////////////////8=')
Out[30]: b'\xfe\xff\xfc\xff\xf8\xff\xf0\xff\xe0\xff\xc0\xff\x80\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'
In [27]: x = ''.join(['{:08b}'.format(c) for c in base64.b64decode('/v/8//j/8P/g/8D/gP8A//////////////////////8=')])
In [29]: print('\n'.join([x[i:i+16] for i in range(0, len(x), 16)]))
1111111011111111
1111110011111111
1111100011111111
1111000011111111
1110000011111111
1100000011111111
1000000011111111
0000000011111111
1111111111111111
1111111111111111
1111111111111111
1111111111111111
1111111111111111
1111111111111111
1111111111111111
1111111111111111
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment