Skip to content

Instantly share code, notes, and snippets.

😴
= (λx.x x)(λx.x x)

Nathan Lilienthal nixpulvis

😴
= (λx.x x)(λx.x x)
Block or report user

Report or block nixpulvis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@nixpulvis
nixpulvis / fib
Last active Jun 26, 2018
Fibonacci (again)
View fib
#!/usr/bin/env elixir
defmodule Math do
def fibfast(n) do fib_acc(1, 0, n) end
def fib_acc(a, b, 0) do a + b end
def fib_acc(a, b, n) do fib_acc(b, a+b, n-1) end
def fibslow(0) do 1 end
def fibslow(1) do 1 end
def fibslow(n) do fibslow(n-1) + fibslow(n-2) end
View slack-one.colors
#282c34,#535A69,#abb2bf,#282c34,#535a69,#ABB2BF,#98c379,#e06c75
@nixpulvis
nixpulvis / config
Last active Jun 4, 2018
Irssi Config
View config
servers = (
{
address = "chat.freenode.net";
chatnet = "Freenode";
port = "6697";
use_tls = "yes";
tls_verify = "yes";
autoconnect = "yes";
}
);
View server.rb
require "socket"
PORT = 1234
server = Socket.new(Socket::AF_INET, Socket::SOCK_STREAM)
# NOTE: Commentting out this line will prevent multiple processes to run at
# once on the same port.
server.setsockopt(Socket::SOL_SOCKET, Socket::SO_REUSEPORT, true)
server.bind(Addrinfo.tcp("", PORT))
@nixpulvis
nixpulvis / data.json
Created Sep 8, 2017
D3 Hierarchical Data
View data.json
{
"name": "Root Node",
"children": [
{ "name": "Child 1", "children": [] },
{ "name": "Child 2", "children": [
{ "name": "Child 3", "children": [] }
]}
]
}
@nixpulvis
nixpulvis / brainfuck-test.rs
Created May 29, 2017
Compare the speed of various BF implementations in Rust.
View brainfuck-test.rs
#![feature(test)]
extern crate test;
extern crate brainfuck;
extern crate bf;
use test::Bencher;
const HELLO_WORLD: &'static str = "++++++++++[>+++++++>++++++++++>+++>+<<<<-]
>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.";
@nixpulvis
nixpulvis / seali.rb
Last active Dec 16, 2016
CLIs with subcommands that don't suck.
View seali.rb
# NOTE: This is a WIP, please pardon our dust.
#
# Example:
#
# git --namespace=foobar clone https://github.com/nixpulvis/seali
# #<Git @args=[], @flags={namespace: "foobar"}, @sub=#<Clone @args=["https://github.com/nixpulvis/seali"], @flags=[], @sub=nil>>
class Seali
class << self
attr_accessor :subs
@nixpulvis
nixpulvis / first_or_create.rb
Last active Jul 26, 2016
Retrying a first or create when two happen at the same time.
View first_or_create.rb
# Simple helper function for retrying a first or create when two happen
# at the same time and one violates the database unique index constraint.
def first_or_create(scope, attributes = {})
begin
scope.first_or_create(attributes)
rescue ActiveRecord::RecordNotUnique
retry
end
end
@nixpulvis
nixpulvis / debug_expr.rs
Created Apr 20, 2016
debug! an expression and it's syntax.
View debug_expr.rs
#[macro_export]
macro_rules! debug_expr {
($expr:expr) => {{
let value = $expr;
debug!("`{}` = {:?}", stringify!($expr), value);
value
}};
}
You can’t perform that action at this time.