This file contains hidden or 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
Rel=fun(Vsn) -> | |
release_handler:unpack_release("eg_"++Vsn), | |
A = application:which_applications(), | |
{ok,OldVsn,[]} = release_handler:install_release(Vsn), | |
B = application:which_applications(), | |
Delta = lists:zip(A--B,B--A), | |
[{relup,OldVsn,Vsn} | |
,{appups,[{App,From,To}||{{App,_,From},{App,_,To}}<-Delta]} | |
] | |
end. |
This file contains hidden or 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
-module(fileop). | |
-export([write_file/3]). | |
-compile({parse_transform,do}). | |
%% Uses an error monad to neatly compose a bunch of failing functions. | |
%% | |
%% Everything being composed returns ok|{ok,Result}|{error,Reason}. At | |
%% the first error, the reason term is returned. The monad factors out | |
%% the behaviour of piping all possible errors to the output (via a | |
%% try-throw or case tree) if they occur. |
This file contains hidden or 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
-module(rpn). | |
-export([eval/1, hypotenuse/2]). | |
-compile({parse_transform,do}). | |
-spec eval([Op]) -> stack_m(ok). | |
%% Interpreter for a simple stack-based language. | |
%% | |
%% Uses a custom stack_m monad, which is a trivial wrapper around state_m[1]. | |
%% It exports: | |
%% -spec pop() -> stack_m(A). |
This file contains hidden or 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
-- | Complete abstract description of the DCPU-16 instruction set. | |
-- | |
-- Based on Version 1.1 of the DCPU-16 Specification by Mojang, retrieved from 0x10c.com. | |
-- | |
-- Contains a trivial "Label" extension, which isn't present in machine code | |
-- but is useful for dealing with assembly. | |
module DCPU16.Instructions where | |
import Data.Word hiding (Word) | |
import Data.ByteString |
This file contains hidden or 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
; Code Obfuscator | |
; | |
; The loader has nice properties shorter versions don't: | |
; 1. doesn't touch registers or stack | |
; 2. can be based anywhere via 'set a,stub' | |
; 3. exercises interpreters ;) | |
:stub xor [begin],0x5eed | |
mul [2+a],25173 ; Grogono LCG | |
add [2+a],13849 | |
add [1+a],1 |
This file contains hidden or 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
augur@niflheim:~/code/c/weird$ xxd -c12 -g4 -s8 dump.bin | more | |
0000008: 204a442e 20666f72 20496e74 JD. for Int | |
0000014: 656c2043 6f726520 32204475 el Core 2 Du | |
0000020: 6f205435 3735300d 0a286329 o T5750..(c) | |
000002c: 2053656c 656e612f 2f323030 Selena//200 | |
0000038: 372c2032 30303800 2b000000 7, 2008.+... | |
0000044: 05000000 26000000 3e000000 ....&...>... | |
0000050: 47020000 e7fdffff 00000000 G........... | |
000005c: a3ffffff a7ffffff 01000000 ............ | |
0000068: 02000000 0a000000 02000000 ............ |
This file contains hidden or 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
# based on http://www.nsa.gov/public_info/_files/tech_journals/communications_extraterrestrial_intelligence.pdf | |
# two related documents I know of: | |
# just message, shorter alphabet, longer: http://www.nsa.gov/public_info/_files/tech_journals/extraterrestrial_intelligence.pdf | |
# solutions: http://www.nsa.gov/public_info/_files/tech_journals/extraterrestrial_messages.pdf | |
""" | |
(1) A. B. C. D. E. F. G. H. I. J. K. L. M. N. O. P. Q. R. S. T. U. V. W. X. Y. | |
Z. *. &. $. ^. #. @. A. B. C. D. E. F. G. H. I. J. K. L. M. N. O. P. | |
Q. R. S. T. U. V. W. X. Y. Z. *. &. $. ^. #. @. | |
(2) A A, B; A A A, C; A A A A, D; A A A A A, E; A A A A A A, F; | |
A A A A A A A, G; A A A A A A A A, H; A A A A A A A A A, I; |
This file contains hidden or 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
#!/usr/bin/env python3 | |
"""Usage: vimcrypt.py [FILE]... | |
Guesses first 64 bytes of vim-encrypted files. Method implemented is sufficient | |
for plain English (preferably with lots of spaces), but any knowledge of | |
underlying plaintext would do. | |
Example: | |
$ ./vimcrypt.py 1.txt 2.txt 3.txt 4.txt |
This file contains hidden or 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
"""Looking for collisions in Mooltipass "TRNG" output. | |
The "TRNG" outputs 32 bit blocks whitened with Jenkins one at a time hash, | |
keeping no state between samples. Running ent or diehard on the output stream | |
produces a predictable "pass" result, since these tests do not take the 32 bit | |
block structure into account. | |
Excessive collisions found by the following test would disprove the null | |
hypothesis that each 32 bit sample from the "TRNG" is uniformly distributed. |
This file contains hidden or 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
"""Poke interesting instructions from Python. | |
Uses the nifty trick in https://github.com/AmihaiN/pyAsm to run snippets then | |
inspect registers. (Use at own risk, nasm.exe source not verified, etc.) | |
""" | |
from pyAsm import pyAsm, A_32BIT | |
def regs(reg, sep='\n', txt=''): | |
txt = txt.strip() | |
acc = [] |