Skip to content

Instantly share code, notes, and snippets.

View thoughtpolice's full-sized avatar
👊
omae wa mou shindeiru

Austin Seipp thoughtpolice

👊
omae wa mou shindeiru
View GitHub Profile
@thoughtpolice
thoughtpolice / gist:1725018
Created February 2, 2012 18:33
radare yay
$ r2 -a x86.bea ./a.out
Cannot use 'x86.bea' anal plugin.
Cannot use 'x86.bea' anal plugin.
-- Change the registers of the child process in this way: '!set eax 0x333'
[0x00400490]> pD 461 @ sym.aes_test
0x004005ae sym.aes_test:
0x004005ae 53 push rbx
0x004005af ba60a04000 mov edx, sym.edst
0x004005b4 be60604000 mov esi, sym.src2
0x004005b9 bf60204000 mov edi, sym.src1
#!/usr/bin/perl -w
use Socket;
use IO::Handle;
$port=3389;
$host='127.0.0.1';
$packhost=inet_aton($host);
$address=sockaddr_in($port,$packhost);
socket(SERVER, AF_INET, SOCK_STREAM, getprotobyname('tcp'));
@thoughtpolice
thoughtpolice / typenats.hs
Created April 9, 2012 18:48
Type literals
-- probably broken
-- no polymorphic kind signatures, which may make things cleaner
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators#-}
/* Static assertions.
** GCC 4.6 and Clang 3.0 has support for _Static_assert under C1x
** so we use that here if it's available.
*/
#if (defined(COMPILER_GNUC) && \
(4 < __GNUC__ || (__GNUC__ == 4 && 6 <= __GNUC_MINOR__))) \
|| __has_extension(c_static_assert)
# define STATIC_ASSERT(cond,m) _Static_assert(cond, m)
#else
/* Not GCC 4.6 || Clang 3.0 */
@thoughtpolice
thoughtpolice / Codensity.hs
Created September 12, 2012 07:14
Codensity transformation, problem set, solutions, notes, and other stuff
-- Inspired by the writings of Edward Kmett, Edward Yang and Gabriel Gonzalez
-- concerning free monads and the codensity transformation.
--
-- http://comonad.com/reader/2011/free-monads-for-less/
-- http://blog.ezyang.com/2012/01/problem-set-the-codensity-transformation/
-- http://www.haskellforall.com/2012/06/you-could-have-invented-free-monads.html
--
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
@thoughtpolice
thoughtpolice / teletype.hs
Created September 14, 2012 15:23
Free monads
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE DeriveFunctor #-}
module Teletype
( main -- :: IO ()
) where
import Prelude hiding (putStrLn, getLine)
import qualified Prelude as P (putStrLn, getLine)
import qualified System.Exit as Exit (exitSuccess)
import System.Environment (getArgs)
@thoughtpolice
thoughtpolice / Test1.agda
Created October 5, 2012 19:41
Agda compiler, from Conor McBride
module Test1 where
{- numbers -}
data Nat : Set where
zero : Nat
suc : (n : Nat) -> Nat
{-# BUILTIN NATURAL Nat #-}
{-# BUILTIN ZERO zero #-}
{-# BUILTIN SUC suc #-}
@thoughtpolice
thoughtpolice / ochacaml.diff
Created November 18, 2012 00:32
OchaCaml 110912
diff -urN -X diff.txt cl75/config/m.h OchaCaml/config/m.h
--- cl75/config/m.h 1999-06-12 06:02:22.000000000 +0900
+++ OchaCaml/config/m.h 2011-08-26 16:59:46.000000000 +0900
@@ -1,3 +1,3 @@
#define CAML_SIXTYFOUR
#undef CAML_BIG_ENDIAN
-#define CAML_ALIGNMENT
+#undef CAML_ALIGNMENT
diff -urN -X diff.txt cl75/config/s.h OchaCaml/config/s.h
--- cl75/config/s.h 1999-06-12 06:02:44.000000000 +0900
@thoughtpolice
thoughtpolice / ADDual.hs
Created December 18, 2012 16:31
Automatic differentiation via dual numbers
{-# LANGUAGE ViewPatterns #-}
module ADDual where
{--
Dual numbers are an extension of the real numbers, like Complex
numbers, only with the identity that d^2 = 0. They are represented
similarly to complex numbers as well, i.e. a+b*d where 'a' and 'b' are
real numbers.
@thoughtpolice
thoughtpolice / gist:4342195
Created December 20, 2012 01:07
clang diagnostics
/home/a/code/qemu/i386-dis.c:5748:19: error: adding 'char' to a string does not append to the string [-Werror,-Wstring-plus-int]
oappend ("%es:" + intel_syntax);
~~~~~~~^~~~~~~~~~~~~~
/home/a/code/qemu/i386-dis.c:5748:19: note: use array indexing to silence this warning
oappend ("%es:" + intel_syntax);
^
& [ ]