Skip to content

Instantly share code, notes, and snippets.

View brainrake's full-sized avatar
λ ék .

Márton Boros brainrake

λ ék .
  • Budapest, Hungary
View GitHub Profile

Keybase proof

I hereby claim:

  • I am brainrape on github.
  • I am brainrape (https://keybase.io/brainrape) on keybase.
  • I have a public key ASDb9JEd0zAfwt34CvSxt69KoXMFYW3rUeiRII1kXHAK9Ao

To claim this, I am signing this object:

updateNpmDeps = pkgs.writeScriptBin "update-frontend-deps" ''
#!${pkgs.stdenv.shell}
set -e
echo; echo "Pinning node dependencies from ./package.json ..."; echo
${pkgs.nix}/bin/nix-instantiate --strict --json --eval --expr '
(import <nixpkgs> {}).lib.mapAttrsToList
(name : value : { "${"\${name}"}" = value; })
(builtins.fromJSON (builtins.readFile ./package.json)).dependencies
' > node-modules.json
${pkgs.nodePackages.node2nix}/bin/node2nix \
@brainrake
brainrake / install-nix.sh
Last active October 14, 2017 20:28
Install Nix without sudo
#!/bin/sh
# Create the /nix directory, and change its ownership
sudo mkdir -p -m 0755 /nix
sudo chown $USER /nix
# Now install normally. It will not use sudo or ask for password.
curl https://nixos.org/nix/install | sh
# Or download, unpack, and run `./install` manually
@brainrake
brainrake / session.txt
Created June 27, 2017 10:25
structural editor interactive session
<"ul" space>
ul _[]_ []
^ List (Attribute msg)
<space>
ul [] _[]_
^ List (Html msg)
<">">
{pkgs ? import <nixpkgs> {}, ...}:
pkgs.stdenv.mkDerivation {
name = "a-slower-speed-of-light";
src = pkgs.fetchurl {
url = http://web.mit.edu/gambit/summer12/speedoflight/beta/A_Slower_Speed_of_Light.tgz;
sha256 = "095kbvpjwzllm0p0c92100vsk40fdrxp2ak3wvdbmk3vzfvbxb6v";
};
installPhase = with pkgs; ''
@brainrake
brainrake / a.hs
Created January 31, 2017 11:39
head of empty list in haskell
main = print $ show $ head []
@brainrake
brainrake / Machine.elm
Last active January 31, 2017 10:58
simple type-level state machine in elm. invalid tra
module Machine exposing (..)
type DoorState = Opened | Closed
type ClosedDoor = ClosedDoor DoorState
type OpenedDoor = OpenedDoor DoorState
@brainrake
brainrake / config.toml
Created January 29, 2017 15:46
gitlab runner config to run under nixos with shared nix store
concurrent = 32
check_interval = 3
[[runners]]
name = "ci"
url = "https://gitlab.com/ci"
token = "${gitlab_runner_token}"
executor = "docker"
environment = ["NIX_REMOTE=daemon", "NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixpkgs"]
pre_build_script = "export PATH=$PATH:/run/current-system/sw/bin; unset SSL_CERT_FILE; unset GIT_SSL_CAINFO"
[runners.docker]
@brainrake
brainrake / buttons.js
Created January 12, 2017 22:08
model-view-update in js
<html>
<body>
<script src="https://gitcdn.xyz/repo/Matt-Esch/virtual-dom/master/dist/virtual-dom.js"></script>
<script>
var h = require('virtual-dom/h');
var diff = require('virtual-dom/diff');
var patch = require('virtual-dom/patch');
var createElement = require('virtual-dom/create-element');
module Main where
import Prelude
import Control.Monad.Eff.Console (log)
-- give a name to an extensible record with fields common to all ducks
type Duck a = { name :: String
, color :: String | a }