Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/python2.4
#
# Copyright 2007 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
@Kiwi
Kiwi / c.hs
Created April 17, 2019 06:12 — forked from tonymorris/c.hs
cancelUnit ::
Iso (a, ()) (b, ()) a b
cancelUnit =
iso
(\(a, ()) -> a)
(\b -> (b, ()))
cancelVoid ::
Iso (Either a Void) (Either b Void) a b
@Kiwi
Kiwi / Cosort.hs
Created April 29, 2019 17:26
Contravariant version of Divide and Conquer algorithm
#! /usr/bin/env cabal
{- cabal:
build-depends:
, base ^>= 4.12
, contravariant ^>= 1.5
-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
@Kiwi
Kiwi / conf.nix
Created February 6, 2020 16:43 — forked from sorki/conf.nix
overlays prototype
hardware.deviceTree.overlays = [
{ name = "spi"; dtsFile = "${./dt/spi.dts}"; }
{ name = "pps";
dtsText = ''
/dts-v1/;
/plugin/;
/ {
compatible = "raspberrypi";
fragment@0 {
@Kiwi
Kiwi / demo.hs
Created February 28, 2020 23:20
arduino-copilot eeprom demo
{-# LANGUAGE RebindableSyntax #-}
import Copilot.Arduino.Uno
import qualified Copilot.Arduino.Library.EEPROMex as EEPROM
import qualified Copilot.Arduino.Library.Serial as Serial
import System.Posix.Env
import qualified Prelude
main :: IO ()
main = do
@Kiwi
Kiwi / gist:06f2f343cac84be515133579b83b4ecd
Created September 20, 2020 04:34 — forked from wess/gist:c66382198d48238787718b9bb8e9f3d9
Start/End GCodes for BLTouch Ender 3
; Ender 3 Custom Start G-code
M140 S{material_bed_temperature_layer_0} ; Set Heat Bed temperature
M190 S{material_bed_temperature_layer_0} ; Wait for Heat Bed temperature
M104 S160; start warming extruder to 160
G28 ; Home all axes
G29 ; Auto bed-level (BL-Touch)
G92 E0 ; Reset Extruder
M104 S{material_print_temperature_layer_0} ; Set Extruder temperature
G1 X0.1 Y20 Z0.3 F5000.0 ; Move to start position
M109 S{material_print_temperature_layer_0} ; Wait for Extruder temperature
@Kiwi
Kiwi / ghci.conf
Created October 27, 2020 17:06 — forked from emilypi/ghci.conf
My modest ghci.conf
:set -XRankNTypes
:set -XGADTs
:set -XTypeFamilies
:set -XTypeApplications
:set -XBangPatterns
:set -XMagicHash
:set -XMultiParamTypeClasses
:set -XPatternSynonyms
:set -XDataKinds
:set -XConstraintKinds
@Kiwi
Kiwi / logical.nix
Last active December 7, 2020 18:49 — forked from matejc/logical.nix
nixops example with nixos-container
{ cert ? "", key ? "" }: {
server = { config, pkgs, ... }: {
services.openssh.enable = true;
services.panamax.enable = false;
};
hidden = { config, lib, pkgs, ... }: with lib; {
options = {
owncloudHost = lib.mkOption {
default = "";
{ config, pkgs, ...}: {
systemd.services.generate-nix-cache-key = {
wantedBy = [ "multi-user.target" ];
serviceConfig.Type = "oneshot";
path = [ pkgs.nix ];
script = ''
[[ -f /etc/nix/private-key ]] && exit
nix-store --generate-binary-cache-key ${config.networking.hostName}-1 /etc/nix/private-key /etc/nix/public-key
'';
};
@Kiwi
Kiwi / nix-package-search
Created January 24, 2021 17:22 — forked from olejorgenb/nix-package-search
nix-package-search