Skip to content

Instantly share code, notes, and snippets.

Max A.K. max630

Block or report user

Report or block max630

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View test chan+exec
#!/usr/bin/env tclsh
package require Tk
pack \
[button .send -text Send -command {puts [lindex $pIn 1] $inData}] \
[entry .b -textvariable inData] \
[text .a]
set pIn [chan pipe]
max630 / SoTrans.hs
Created May 5, 2018
"Properly" call callbacks inside IO with transformers
View SoTrans.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
module SoTrans where
import Control.Concurrent.MVar
import Control.Monad
max630 / MainCLI.hs
Last active Feb 8, 2018
testing prime speed
View MainCLI.hs
module Main where
import System.Environment(getArgs)
import qualified Prime
main :: IO ()
main = do
a <- getArgs
Prime.main (a !! 0) (read (a !! 1))
max630 / BitbucketServer_FirstParentsOnly.user.js
Last active Jun 10, 2017
Greasemonkey script to show only first parents in bitbucket server's commit list
View BitbucketServer_FirstParentsOnly.user.js
// ==UserScript==
// @name BitbucketServer_FirstParentsOnly
// @namespace
// @include*
// @version 1
// @grant none
// @run-at document-idle
// ==/UserScript==
function HandleContent() {
max630 / gist:2872656
Created Jun 5, 2012
Russian phonetic layout for MS Keyboard Layout Creator
View gist:2872656
KBD RU2 "Russian Phonetic"
COPYRIGHT "(c) 2011 "
LOCALEID "00000419"
max630 / TryOptions.lhs
Created Jan 25, 2017
optparse-applicative question
View TryOptions.lhs
> {-# LANGUAGE TupleSections #-}
> import Control.Applicative
> import Data.List (isPrefixOf)
> import Options.Applicative
> prefixReader expect = eitherReader $ prefixReader' expect
> prefixReader' expect s = if expect `isPrefixOf` s
> then Right s
> else Left ("not(\"" ++ s ++ "\" `isPrefixOf` \"" ++ expect ++ "\")")
max630 / T1.hsc
Created Dec 15, 2016
getting HANDLE name
View T1.hsc
{-# LANGUAGE TypeFamilies #-}
module T1 where
import qualified Graphics.Win32.Misc as WM
import qualified System.Win32.Types as WT
import qualified System.Win32.File as WF
import Data.Int
import Data.Word
import Foreign.Ptr(Ptr())
max630 /
Created Nov 5, 2016
pr3436 vs submodules
set -e
mkdir -p /tmp/pr3436/sub_origin
cd /tmp/pr3436/sub_origin
git init /tmp/pr3436/sub_origin
mkdir subdir
seq 1 10 >subdir/f
git add subdir/f
max630 / InlineDoBind.hs
Last active Apr 18, 2016
syb based implementation of InlineDoBind
View InlineDoBind.hs
{-# LANGUAGE FlexibleContexts, TemplateHaskell, TupleSections #-}
module InlineDoBind where
import Data.Data (Data, gmapM)
import Data.Generics.Aliases (extM)
import Language.Haskell.TH (Exp(DoE,AppE,VarE,InfixE),Stmt(BindS),Pat(VarP))
import Language.Haskell.TH.Syntax (Quasi,qNewName)
import Control.Monad.Trans.Writer.Strict (runWriterT,WriterT)
import Control.Monad.Trans.Class (lift)
max630 / MonadStateIO.hs
Created Feb 8, 2016
Monad.Trans.State replacement which uses IORef and keeps state across exceptions
View MonadStateIO.hs
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE UndecidableInstances #-}
module MonadStateIO (evalStateT,execStateT) where
import Data.Tuple (swap)
import qualified Control.Applicative as App
import qualified Control.Monad.Catch as MC
import qualified Control.Monad.Trans as MT
You can’t perform that action at this time.