Skip to content

Instantly share code, notes, and snippets.

"""
Simple EDSAC Assembler.
The MIT Liecense.
Copyright (C) Daniel Hagon, 2017.
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 all copies or substantial portions of the Software.
@axiomsofchoice
axiomsofchoice / samuel_louis_ludwik.py
Created November 19, 2016 17:40
#GCHQpuzzlebook solution
# Solution to http://www.bbc.co.uk/programmes/articles/5m5cv4NM5dWx108YgCQXj9J/can-you-crack-gchqs-code-breaker-challenge
# By Dan Hagon, 19/11/2016.
# CC0 License.
samuel_lines = [
# 2 7 9 2 5 2 2 5 3 8 2 6 7
"IN AAAAIAN INAAANAIA IA IAINA AI AA IAIIA IAA AAIAAINN AA IAAANN IAINANI",
"NA ANNNNMA NAANIANMN NN ANNAN NN AM MNNNN ANI MAAINNIA AM NNAMIA NNAANIN",
"AM MMIAAMA MMIMAAMMA MM AMAAA MA AM AAAMA AAA MAMAAAAM AM AAIMMM MMMMAMA"
@axiomsofchoice
axiomsofchoice / e.py
Last active June 15, 2016 14:48
How to estimate the number e on a checkerboard
# via https://twitter.com/JohnAllenPaulos/status/743085219511554049
import string
import random
print 64.0 / float(string.count(bin(reduce(lambda x,y: x | (1L<<y), [random.randint(1,64) for _ in range(64)])), '0') - 1)
@axiomsofchoice
axiomsofchoice / random_wlak_problem_1.md
Last active May 27, 2016 16:22
Solution to Random Walk Problem #1
@axiomsofchoice
axiomsofchoice / LICENSE.txt
Last active April 19, 2016 09:55
Minimal mapping from the three dice event space to the two dice event space
The MIT License (MIT)
Copyright (c) 2016 Dan Hagon
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 all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFT
@axiomsofchoice
axiomsofchoice / cipher.py
Last active February 2, 2016 11:57
Cryptanalysis of "Cipher" puzzle, Stage 5, Director GCHQ's Christmas Puzzle 2015.
#!/usr/bin/evn python
"""
Cryptanalysis of "Cipher" puzzle, Stage 5, Director GCHQ's Christmas Puzzle 2015
================================================================================
http://www.gchq.gov.uk/press_and_media/news_and_features/Pages/Director%27s-Christmas-puzzle-2015.aspx
Puzzle Crown Copyright.
SPOILER ALERT - If you're attempting the puzzle and you don't want to find out
any hints do not read ahead!
@axiomsofchoice
axiomsofchoice / registration.py
Created February 1, 2016 14:04
Partial Solution, "Registration" Stage 5 Director GCHQ's Christmas Puzzle 2015.
#!/usr/bin/env python
"""
Partial Solution, "Registration" Stage 5 Director GCHQ's Christmas Puzzle 2015.
===============================================================================
http://www.gchq.gov.uk/press_and_media/news_and_features/Pages/Director%27s-Christmas-puzzle-2015.aspx
Puzzle Crown Copyright.
SPOILER ALERT - If you're attempting the puzzle and you don't want to find out
any hints do not read ahead!
@axiomsofchoice
axiomsofchoice / algebraic.py
Last active February 1, 2016 09:57
Solution to "Algebraic" from Stage 5 of Director GCHQ's Christmas Puzzle 2015
#!/usr/bin/env python
"""
Solution to "Algebraic" from Stage 5 of Director GCHQ's Christmas Puzzle 2015.
==============================================================================
http://www.gchq.gov.uk/press_and_media/news_and_features/Pages/Director%27s-Christmas-puzzle-2015.aspx
Puzzle Crown Copyright.
SPOILER ALERT - If you're attempting the puzzle and you don't want to find out
any hints do not read ahead!
@axiomsofchoice
axiomsofchoice / gchq-xmas-backdoor.js
Last active December 20, 2015 17:22
Backdoor found in GCHQ Christmas Puzzle
/*
Backdoor found in GCHQ Christmas Puzzle
=======================================
SPOILER ALERT - If you're attempting the puzzle and you don't want to find out
any hints do not read ahead!*
Yesterday I completed Part 4 of the GCHQ Christmas Puzzle
[http://www.gchq.gov.uk/press_and_media/news_and_features/Pages/Director%27s-Christmas-puzzle-2015.aspx].
import requests
import json
for page in range (50):
# Must be 100 entries at a time
params = (100, 100*page)
# Replace axiomsofchoice with your own feed
r = requests.get('http://friendfeed-api.com/v2/feed/axiomsofchoice?fof=1&hidden=1&raw=1&num=%d&start=%d' % params)