Skip to content

Instantly share code, notes, and snippets.

View keybase.md

Keybase proof

I hereby claim:

  • I am zmaril on github.
  • I am zmaril (https://keybase.io/zmaril) on keybase.
  • I have a public key ASBSk8HWQgCYHukY5NAte5V6YE7IXitE1OkatCXhsz0-hAo

To claim this, I am signing this object:

View ssh_scp.c.clj
[{:lines ["/* $OpenBSD: scp.c,v 1.187 2016/09/12 01:22:38 deraadt Exp $ */" 
          "/*" 
          "* scp - secure remote copy.  This is basically patched BSD rcp which" 
          "* uses ssh to do the data transfer (instead of using rcmd)." 
          "*" 
          "* NOTE: This version should NOT be suid root.  (This uses ssh to" 
          "* do the transfer and ssh has the necessary privileges.)" 
          "*" 
          "* 1995 Timo Rinne <tri@iki.fi>, Tatu Ylonen <ylo@cs.hut.fi>" 
          "*" 
View gist:ce4cb4b17d62c33c1924
(ns example.test
(:require [aleph.tcp :as tcp]
[manifold.stream :as stream]))
(defn handler [s info]
(println "START")
(println @(stream/take! s))
(println "STOP"))
(defn start-server
View strlenc.clj
(ns instagenerate.strlenc
(:refer-clojure :exclude [==])
(:require [clojure.core.logic :as l :refer [run* fresh ==]]
[clojure.core.logic.protocols :as lp])
(:import [clojure.core.logic LCons]))
(defn lcount [l]
(loop [i 0 l l]
(println i l)
(if (and (= LCons (type l)) (.d l))
@zmaril
zmaril / simpletest.py
Created Feb 19, 2014
Simple bug hunting test
View simpletest.py
import unittest
from newMethod import GG,Key
class TestnewMethod(unittest.TestCase):
def test_GG(self):
r = GG(Key(8,[[99, 99, 99, 3, 99, 5, 6, 7], [99, 99, 99, 3, 99, 5, 6, 7], [99, 99, 99, 3, 99, 5, 6, 7], [99, 99, 99, 3, 99, 5, 6, 7], [99, 99\
, 99, 3, 99, 5, 6, 7], [99, 99, 99, 3, 99, 5, 6, 7], [99, 1, 99, 3, 99, 99, 6, 7], [99, 1, 99, 3, 99, 99, 6, 7]]))
self.assertEqual(r.solutions,80)
self.assertTrue(r.alternating)
@zmaril
zmaril / index.html
Created Nov 13, 2013
TPP highlighted
View index.html
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> - jsFiddle demo</title>
<script type="text/javascript" src="http://code.jquery.com/jquery-git2.js"></script>
<link rel="stylesheet" type="text/css" href="/css/result-light.css">
@zmaril
zmaril / map_with_indexed.jl
Created Oct 9, 2013
map_with_indexed for julia
View map_with_indexed.jl
function map_with_indexed(f,cs...)
args = Any[f,]
push!(args,1:endof(first(cs)))
for c in cs
push!(args,c)
end
apply(map,args)
end
@zmaril
zmaril / index.html
Created Oct 1, 2013
Quicksort in 3d (?)
View index.html
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
@zmaril
zmaril / index.html
Last active Dec 24, 2015
Quicksort in 3d
View index.html
<!doctype html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
@zmaril
zmaril / intro.md
Last active Dec 23, 2015
Reverse polish notation macro compiler
View intro.md

I've been messing around with macro compilation and embedded languages in Julia. This is a reverse polish notation compiler built into a macro. Be forewarned, I don't really know julia or how to build a compiler.

I wanted the compiler to leak, so I could pull in environmental variables. a=1; rpn"a 1 +" #Totally valid and should be 2

I wanted the compiler to be able to take in information about the number of arguments to a function. N!f tells the compiler what to do. The default for N is 2. rpn"1 2 3 3!+" # should be 6

Thanks to being a compiler that is porous (unhygenic?), this means that all the power of julia is available to you, the reverse polish notation programmer.