Skip to content

Instantly share code, notes, and snippets.

module Main where
import Data.List
import Data.Tree
data Elem a = Elem { elemVec :: [Double], elemData :: a }
deriving (Show)
data KDTree a
= Branch Int Double Int (KDTree a) (KDTree a)
@utdemir
utdemir / THLPE.hs
Last active May 14, 2019 00:35
Property Checking "The Hardest Logic Puzzle Ever"
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE RecordWildCards #-}
module Game.THLPE
( THLPE ()
, GodAnswer (..)
, GodType (..)
, GodName (..)
{ old, new, pkgs ? import <nixpkgs> {}}:
let
packages = [
"aeson" "Agda" "attoparsec" "cassava" "conduit" "cryptonite"
"diagrams-core" "distributed-process" "esqueleto" "git-annex" "hakyll"
"hedgehog" "hlint" "http-client" "idris" "lens" "pandoc" "pipes"
"purescript" "QuickCheck" "servant" "servant-server" "ShellCheck"
"singletons" "tls"
];
diff --git a/modules/modules.nix b/modules/modules.nix
index 0e18795..a5d1757 100644
--- a/modules/modules.nix
+++ b/modules/modules.nix
@@ -27,7 +27,7 @@ let
(loadModule ./misc/gtk.nix { })
(loadModule ./misc/lib.nix { })
(loadModule ./misc/news.nix { })
- (loadModule ./misc/nixpkgs.nix { })
+ # (loadModule ./misc/nixpkgs.nix { })
let
pkgsOrig = import <nixpkgs> {};
pkgsMusl = pkgsOrig.pkgsMusl;
extraLibraries = with pkgsMusl; [
musl
zlib zlib.static
libffi (libffi.override { stdenv = makeStaticLibraries stdenv; })
gmp (gmp.override { withStatic = true; })
];
docker =
@utdemir
utdemir / pocket-login.bash
Last active December 22, 2019 08:40
Tiny shellscript to authenticate to Pocket (getpocket.com).
#!/usr/bin/env bash
REDIRECT="http://127.0.0.1:7777"
echo "Enter your consumer key."
echo "You can get it from: https://getpocket.com/developer/apps/new"
read -p "> " consumer_key
code=$(
curl -sX POST --data "consumer_key=$consumer_key&redirect_uri=$REDIRECT" \
extern crate bindgen;
use std::env;
use std::path::PathBuf;
// Fix for: the name `IPPORT_RESERVED` is defined multiple times
// Issue: https://github.com/rust-lang/rust-bindgen/issues/687
#[derive(Debug)]
struct IgnoreMacros(Vec<String>);
fzf-history-uniq() {
selected=$(
history 0 \
| awk '{
match($0, /^ *([0-9]+) *(.*)$/, r);
num=r[1]; cmd=r[2];
if(s[cmd]=="") { print cmd; s[cmd]=1; } }' \
| fzf --tac )
BUFFER="$selected"
zle end-of-line
#!/usr/bin/env sh
STRETCH_DURATION_SECONDS=20
STRETCH_INTERVAL_MINUTES=10
REST_RECURRENCE=6
REST_DURATION_MINUTES=10
if ! command -v yad >/dev/null 2>&1; then
echo "This script requires a 'yad' executable on PATH. Exiting." 2>&1

Keybase proof

I hereby claim:

  • I am utdemir on github.
  • I am utdemir (https://keybase.io/utdemir) on keybase.
  • I have a public key whose fingerprint is 76CC C3C7 A739 8C13 21F5 438B F3F8 629C 3E0B F60B

To claim this, I am signing this object: