Skip to content

Instantly share code, notes, and snippets.

View willbasky's full-sized avatar

Vladislav Sabanov willbasky

  • Buenos Aires
View GitHub Profile
@willbasky
willbasky / Timer.hs
Created January 28, 2022 14:43
Higher-order effect of timer for Polysemy
module Main where
import Data.Time.Clock.POSIX
import Control.Concurrent
import Polysemy
import Polysemy.Final
import Polysemy.Trace
import Polysemy.Error
import Data.Kind
import Polysemy.Final (interpretFinal)
@willbasky
willbasky / sc3-plugins.nix
Created August 30, 2019 14:32 — forked from gosub/sc3-plugins.nix
Nix package definition for sc3-plugins
with import <nixpkgs> {};
stdenv.mkDerivation {
name = "sc3-plugins-3.7.0-beta";
src = fetchgit {
url = "https://github.com/supercollider/sc3-plugins";
rev = "a963ecb";
sha256="0840jwh7ljmhg34zblahqx3abk42a3y3gvgb740r558rphbp1p19";
fetchSubmodules = true;
fibs :: [Integer]
fibs = 1 : scanl (+) 1 fibs
fibsN :: Int -> Integer
fibsN x = fibs !! x
fibsT :: Int -> Integer
fibsT x = last $ take x fibs
-- Scans Exercises
data DatabaseItem = DbString String | DbNumber Integer | DbDate UTCTime
deriving (Eq, Ord, Show)
theDatabase :: [DatabaseItem]
theDatabase =
[ DbDate (UTCTime (fromGregorian 1911 5 1) (secondsToDiffTime 34123))
, DbNumber 9001
, DbString "Hello, world!"
, DbDate (UTCTime (fromGregorian 1921 5 1) (secondsToDiffTime 34123))
]
Eq Instances
1.
> data TisAnInteger = TisAn Integer
> instance Eq TisAnInteger where
> TisAn n == TisAn n' = n == n'
2.
> data TwoIntegers = Two Integer Integer
> instance Eq TwoIntegers where
> Two n m == Two n' m' = (n == n') && (m == m')
3.
{-# LANGUAGE OverloadedStrings #-}
module Tui where
import Brick.AttrMap
import Brick.Main
import Brick.Types
import Brick.Util
import Brick.Widgets.Border
import Brick.Widgets.Core
@willbasky
willbasky / shell
Created October 28, 2018 19:33
ops
$ ansible-playbook ssh.yaml -vvv
ansible-playbook 2.5.1
config file = /media/metaxis/stock/Coding/ops/playbook/ansible.cfg
configured module search path = [u'/home/metaxis/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
Using /media/metaxis/stock/Coding/ops/playbook/ansible.cfg as config file
Parsed /media/metaxis/stock/Coding/ops/playbook/hosts inventory source with ini plugin
@willbasky
willbasky / hs
Last active October 10, 2018 13:48
CmdShow id -> do
doc <- cmdShowId @Note id
case doc of
Right Storage.Document{value} -> pprint $ withHeader "Note:" $ UI.noteViewFull $ noteView id value
Left _ -> do
doc <- cmdShowId @Contact id
case doc of
Right Storage.Document{value} -> pprint $ withHeader "Contact:" $ UI.contactViewFull $ contactView id value
Left e -> liftIO $ pprint a
@willbasky
willbasky / shell
Created October 10, 2018 09:43
ff search
$ ff search -w wiki -b
Wiki notes:
* Hello, wiki! | id 474uyd0t4oq-2lvlyseskf
* wiki | id 47jkpd8vkk8-2lvlyseskf
* wiki4 | id 47jlvd36qy3-2lvlyseskf
* wiki5 | id 47jlvq67rik-2lvlyseskf
* wiki4 | id 47jlvzc1kki-2lvlyseskf
$ ff search -c wiki -b
Contacts:
* wiki | id 47jodpnkeod-2lvlyseskf
{-# LANGUAGE StrictData #-}
module FF.Options
( Cmd (..)
, CmdAction (..)
, Config (..)
, DataDir (..)
, Edit (..)
, New (..)
, Search (..)