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
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
; 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
-- | 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
-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
-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
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
(defmodule octree | |
(export all)) | |
(include-file "all2.lfe") ; lfe_utils library | |
;; Vectors: | |
(defmacro :vec3 ((x y z) `(tuple 'vec3 ,x ,y ,z))) | |
(defn :+ [(:vec3 x y z) (:vec3 a b c)] |
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(iter). | |
-export([fac/1]). | |
-define( for(Arg,Seed,Body) | |
, begin F = fun(Iter,Arg)->Body end, F(F,Seed) end | |
). | |
-define( iter(Arg) | |
, Iter(Iter,Arg) | |
). | |
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
;; ([{atom(),binary()}], pid()) -> {missing,atom()} | |
;; | {bad_value,atom()} | |
;; | {unescaped,|atom()} | |
;; | malicious | |
;; | ok. | |
(defn sanitize [args logger-pid] | |
(ablock user-err | |
; check for user screwing up the input, inform them | |
(check-missing args) | |
(if (/= '() it) |