Skip to content

Instantly share code, notes, and snippets.

View 3noch's full-sized avatar
🕯️

Elliot Cameron 3noch

🕯️
  • Indiana
View GitHub Profile
@3noch
3noch / Test.hs
Last active April 21, 2020 00:11
ghcide-pgmF
main = print x
@3noch
3noch / url.hs
Created October 15, 2019 22:05
url.hs
module Url where
import Data.Text (Text)
import qualified Data.Text as T
import Data.Word (Word)
newtype Scheme = Scheme Text deriving (Eq, Ord, Show)
newtype Host = Host Text deriving (Eq, Ord, Show)
newtype Path = Path [Text] deriving (Eq, Ord, Show)
newtype Query = Query [(Text, Text)] deriving (Eq, Ord, Show)
@3noch
3noch / help.nix
Last active September 5, 2019 15:41
Nix Help Builder
{ lib, ... }:
let
inherit (lib) any attrValues concatStringsSep filterAttrs isAttrs isDerivation mapAttrs mapAttrsToList;
in rec {
internal = rec {
mapAttrsNestedRecursiveCond = pred: f: set:
let
recurse = path: set:
let
g = name: value:
@3noch
3noch / fixit.py
Last active May 4, 2019 03:44
Fixpoint for Iterators
import collections.abc as ABC
from itertools import islice, tee
class MutableIterator(ABC.Iterator):
def __init__(self, nexts=()):
self.nexts = list(nexts)
def __next__(self):
if self.nexts:
return self.nexts.pop()
@3noch
3noch / PolyVar.hs
Last active February 26, 2019 14:37
#! /usr/bin/env nix-shell
#! nix-shell -i ghci -p "pkgs.haskellPackages.ghcWithPackages(p: [p.constraints])"
{-# LANGUAGE GADTs #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
@3noch
3noch / WrinkCodeBlock
Created October 4, 2018 19:32
Wrinkl Code Block
Short code block:
So if you run `this silly command` it does that.
Long code block:
So if you run ```this
large thing
of many lines of text
that is like code```
@3noch
3noch / IsMap.hs
Created July 11, 2018 19:23
IsMap.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE UndecidableInstances #-}
module IsMap where
import qualified Data.AppendMap as AppendMap
import Data.IntervalMap.Generic.Interval (Interval)
@3noch
3noch / README.md
Created June 18, 2018 04:02
Playing Steam Game for Windows on NIxOS

Using Steam under Wine

  1. Install wine.
  2. Run winecfg and select the right version of windows.
  3. Download Steam for Windows.
  4. Run wine SteamInstaller.exe
  5. Refer to this thread to change configuration for steam so it can download your library content as Windows: * https://steamcommunity.com/discussions/forum/1/2381701715716658433/ * In particular: https://www.reddit.com/r/wine_gaming/comments/8r0gh6/steam_in_winedevel_content_servers_unreachable/e0riqd9
  6. Run steam with wine ~/.wine/c_drive/..../Steam.exe.
  7. Login/download game from library and play it.
@3noch
3noch / ScrapeMailgunLogsPage.js
Created February 5, 2018 19:53
Scrape Emails from Mailgun Web Logs
re = /"to": "([^"]+)"/; pres = document.getElementsByTagName("pre"); for (i = 0; i < pres.length; i++) { matches = re.exec(pres[i].innerHTML); console.log(matches[1]); }
@3noch
3noch / MoreLocatoin.hs
Created January 14, 2018 00:20
Location
{-# LANGUAGE CPP #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LANGUAGE JavaScriptFFI #-}
module App.Front.Lib.Location where
import Data.Text (Text)
import GHC.Generics (Generic)
import GHCJS.DOM (currentWindowUnchecked)
import GHCJS.DOM.EventTarget (dispatchEvent_)