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
@brainrake
brainrake / shell.nix
Created May 4, 2023 20:18
nodejs-12_x
{ hostPkgs ? import <nixpkgs> { }, ... }:
let
src = hostPkgs.fetchFromGitHub {
owner = "NixOS";
repo = "nixpkgs";
rev = "1db42b7fe3878f3f5f7a4f2dc210772fd080e205";
sha256 = "sha256-8LEHoYSJiL901bTMVatq+rf8y7QtWuZhwwpKE2fyaRY=";
};
pkgs = import src { };
in
@brainrake
brainrake / flake.nix
Created March 31, 2023 14:31
cross compile rust to nix
{
inputs = {
nixpkgs.url = github:NixOS/nixpkgs/nixos-unstable;
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
module Quine exposing (main)
import Html exposing (..)
import Html.Attributes exposing (..)
main =
Html.textarea
[ rows 30
, cols 160
{ pkgs ? import <nixpkgs> {}, ... }:
let
openwrt-archer-c7-v5-factory = pkgs.fetchurl {
url = "http://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-19.07.2-ath79-generic-tplink_archer-c7-v5-squashfs-factory.bin";
sha256 = "";
};
openwrt-archer-c7-v5-sysupgrade = pkgs.fetchurl {
url = "http://downloads.openwrt.org/releases/19.07.2/targets/ath79/generic/openwrt-19.07.2-ath79-generic-tplink_archer-c7-v5-squashfs-factory.bin";
sha256 = "";
};
#version 150
uniform float time;
uniform vec2 resolution;
uniform vec2 mouse;
uniform vec3 spectrum;
uniform sampler2D texture0;
uniform sampler2D texture1;
uniform sampler2D texture2;
@brainrake
brainrake / array.js
Last active March 4, 2022 08:03
javascript functional array processing
// sml-list-style array functions
copy = (xs) => xs.slice(0, xs.length)
cons = (x, xs) => { ys = copy(xs); ys.unshift(x); return ys}
isEmpty = (xs) => xs.length == 0
hd = (xs) => xs[0]
tl = (xs) => { ys = copy(xs); ys.unshift(); return ys }
repeat = (n, x) => new Array(n).fill(x)
//
@brainrake
brainrake / deploy.hs
Last active July 15, 2020 06:39
nix-shell shebang haskell turtle nixos deploy script
#! /usr/bin/env nix-shell
#! nix-shell --pure -i runghc -p rsync openssh "haskellPackages.ghcWithPackages (pkgs: [ pkgs.turtle ])"
{-# LANGUAGE OverloadedStrings #-}
import Turtle
import Prelude hiding (FilePath)
import qualified Data.Text as T
sshOpts :: [Text]
sshOpts = ["-o", "StrictHostKeyChecking=accept-new"]
@brainrake
brainrake / Optional.idr
Last active December 2, 2018 08:33
Optional function arguments in Idris
interface Optional a t where
optional : t -> Maybe a
Optional a (Maybe a) where
optional x = x
Optional a a where
optional x = Just x
Optional a () where
@brainrake
brainrake / Overloading.idr
Last active November 30, 2018 16:56
idris type-directed overloading
f : String -> String
f x = x ++ "!"
namespace maybe
f : Maybe String -> String
f (Just x) = x ++ "!"
f Nothing = "_"
test1 : String