Skip to content

Instantly share code, notes, and snippets.

Maris Orbidans maruks

Block or report user

Report or block maruks

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
View transposition.lisp
(defpackage :transposition
(:use :cl))
(in-package :transposition)
(defparameter *text* "WEAREDISCOVEREDFLEEATONCE------")
(defun range (max &key (min 0) (step 1))
(loop for n from min below max by step
collect n))
@maruks
maruks / matrices.lisp
Last active Feb 9, 2020
matrix multiplication
View matrices.lisp
(defpackage :matrices
(:use :cl :iterate)
(:export multiply))
(in-package :matrices)
(defun multiply (m1 m2)
(flet ((multiply-row (row column size)
(iter
(for i :below size)
View cloudy.clj
(defn queue []
(java.util.PriorityQueue.))
(defn peek [pqueue]
(.peek pqueue))
(defn poll [pqueue]
(.poll pqueue)
pqueue)
View spectre.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#else
#include <x86intrin.h> /* for rdtscp and clflush */
#endif
View prison.clj
(ns prison.core
(:require [gniazdo.core :as ws]
[clojure.data.json :as json]
[clojure.string :as str]))
(defn parse [str]
(json/read-str str :key-fn keyword))
(def score (atom {}))
(def last-round (atom nil))
View core.clj
(ns prison.core
(:require [gniazdo.core :as ws]
[clojure.data.json :as json]))
(defn parse [str]
(json/read-str str :key-fn keyword))
(def msg-atom (atom nil))
(defn handle [msg]
View Plumber.ex
defmodule Plumber do
def input(file) do
file
|> File.stream!()
|> Enum.map(&(Regex.split(~r/\D+/, String.trim(&1))))
|> Enum.reduce(%{}, fn([first | rest],acc) -> Map.put(acc,first,rest) end )
end
def count([], acc, input) do
case Map.keys(input) do
@maruks
maruks / plumber.ex
Created Dec 13, 2017
Advent of Code, Day 12
View plumber.ex
defmodule Plumber do
def input do
"/Users/maris/Projects/Advent_of_code_2017/plumber/test/input" |>
File.stream!() |>
Enum.map(&(Regex.split(~r/\D+/, String.trim(&1)))) |>
Enum.reduce(%{}, fn([first | rest],acc) -> Map.put(acc,first,rest) end )
end
def count([], acc, input) do
case Map.keys(input) do
View Main.elm
blur : Dict(Int,Int) Int -> ( Int, Int ) -> Int
blur cells ( x, y ) =
let
xs =
range (x - 1) (x + 1)
ys =
range (y - 1) (y + 1)
points =
@maruks
maruks / join.erl
Created Feb 28, 2017
functions over lists
View join.erl
-module(join).
-import(lists,[foldr/3,foldl/3,filter/2,split/2,flatmap/2,map/2,seq/2]).
-export([join/2,concat/1,member/2,qsort/1,msort/1,isort/1,perms/1]).
join_([X|Xs],Ys) ->
join_(Xs, [X | Ys]);
join_([], Ys) ->
Ys.
You can’t perform that action at this time.