Skip to content

Instantly share code, notes, and snippets.

@zarkzork
zarkzork / Makefile
Created September 12, 2018 07:07
js_of_ocaml Makefile
SECURE_CONFIG_FILE=.env
SECURE_ENV_VARIABLES=${shell cat $(SECURE_CONFIG_FILE)}
BUILD_DIR=_build
TEST_BUILD_DIR=_build_test
COMPILE_INCLUDE_DIR_FLAGS=-I source/std -I source/actions -I source/storages -I source/services -I source/types
COMPILE_INCLUDE_TEST_DIR_FLAGS=-I test/examples -I test/types -I test/storages -I test/actions -I test/services -I test/std
dist/handler.js: node_modules source/*.ml $(wildcard source/*.mli) source/std/*.ml source/std/*.mli source/actions/*.ml source/actions/*.mli
ocamlbuild -no-links -use-ocamlfind -X $(TEST_BUILD_DIR) $(COMPILE_INCLUDE_DIR_FLAGS) -no-sanitize -no-hygiene source/main.byte
js_of_ocaml $(BUILD_DIR)/source/main.byte
FROM rosenhouse/phantomjs2
MAINTAINER Vladimir Terekhov <zarkzork@gmail.com>
RUN apt-get update && apt-get install -y build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config libpq-dev make wget unzip git mysql-client libmysqlclient-dev imagemagick sendmail
RUN git clone https://github.com/sstephenson/rbenv.git /usr/local/rbenv && \
mkdir /usr/local/rbenv/plugins && \
git clone https://github.com/sstephenson/ruby-build.git /usr/local/rbenv/plugins/ruby-build
ENV RBENV_ROOT /usr/local/rbenv
### Keybase proof
I hereby claim:
* I am zarkzork on github.
* I am zarkzork (https://keybase.io/zarkzork) on keybase.
* I have a public key whose fingerprint is 5E00 F5A2 F97F 8682 856C 8800 9D18 BF0C 7B3B FBE2
To claim this, I am signing this object:
@zarkzork
zarkzork / gist:f4f4c30f5f6009697e53
Created December 1, 2014 09:41
sample schema for typtypio
(* schema *)
module type Schema = sig
type t
end
module Schema = struct
type t
type value_type =
@zarkzork
zarkzork / main.rb
Created February 22, 2014 14:25
single pass converter semi-automatic converter from erb to dust
require 'strscan'
# single pass converter semi-automatic converter from erb to dust
input_stream = $stdin.read
# Class to parse ruby line and detect its type, filling symbol table
# with references.
class RubyLine
@zarkzork
zarkzork / search.rb
Created May 23, 2013 11:04
Simple file search in Ruby
class String
def triads()
string = self.clone
Enumerator.new do |y|
while string.size > 2
y << string.slice(0, 3)
string.slice!(0)
end
end
end
@zarkzork
zarkzork / search.hs
Last active December 17, 2015 15:59
simple haskell indexed search for files.
import Data.List
import Data.Map
import System.Environment
import Control.Monad
import System.IO
-- returns triagrams for given string
splitIntoTrigrams :: String -> [String]
splitIntoTrigrams (a : b : c : ls) = (a : b : c : []) : splitIntoTrigrams (b : c : ls)
splitIntoTrigrams (b : c : []) = []
@zarkzork
zarkzork / gist:3332000
Created August 12, 2012 14:04
some shit
(defun next-same-indentation ()
(interactive)
(let ((target-indentation (current-indentation)))
(while (progn
(next-line)
(/= target-indentation (current-indentation))))))
(defun previous-same-indentation ()
(interactive)
class Server
def parse_command
line = $stdin.readline.chomp
command, arguments = line.split(' ', 2)
if commands.include?(command)
self.send(command, arguments)
else
(start-process "ls" nil "ls")
(defun keep-output (process output)
(setq kept (cons output kept)))
(setq kept nil)
(set-process-filter (get-process "ls") 'keep-output)