Skip to content

Instantly share code, notes, and snippets.

View ethercrow's full-sized avatar

Dmitry Ivanov ethercrow

View GitHub Profile
@ethercrow
ethercrow / perf.sh
Last active June 7, 2020 16:07
linux perf checklist
uptime
dmesg | tail
vmstat 1
mpstat -P ALL 1
pidstat 1
iostat -xz 1
free -m
sar -n DEV 1
sar -n TCP,ETCP 1
@ethercrow
ethercrow / et.sh
Created May 11, 2020 15:08
Eventlog -> Chrome -> Tracy
#!/usr/bin/env bash
set -eu
eventlog-to-chrome read "$1"
import-chrome "$1.trace.json" "$1.tracy"
tracy "$1.tracy"
@ethercrow
ethercrow / ppeventlog.hs
Created May 10, 2020 11:22
Debug printing of GHC eventlogs
#!/usr/bin/env stack
-- stack --resolver lts-15.11 --install-ghc script --compile --package ghc-events
{-# language lambdacase #-}
import ghc.rts.events
import system.environment
main :: io ()
main = do
@ethercrow
ethercrow / clj-load-prof.hs
Created February 14, 2020 23:35
clj-load-prof.hs
#!/usr/bin/env stack
-- stack script --resolver lts-14.25 --install-ghc --compile
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NumericUnderscores #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TupleSections #-}
{-# LANGUAGE ViewPatterns #-}
-- --package typed-process
@ethercrow
ethercrow / gist:526e83eda39e7ccd81e44bbcb6ff9e53
Created August 26, 2018 13:20
Req config for flaky services (retry on everything >= 500)
-- Usage:
--
-- import Network.HTTP.Flaky
--
-- instance MonadHttp MyMonad where
-- handleHttpException = liftIO . throwIO
-- getHttpConfig = return flakyConfig
module Network.HTTP.Flaky
( flakyConfig
#!/usr/bin/env python
# reading from file is left out as an exercise
# as is quitting with 'q'
# and wrapping
# and possibly something else
import curses
import sys
@ethercrow
ethercrow / gist:03df8a24aa554ff2a1b8
Created November 20, 2014 09:20
Profile something by its stdout line by line.
import Control.Applicative
import Control.Monad.Loops
import Data.Time.Clock.POSIX
import System.IO
main :: IO ()
main = do
stampedLines <- whileM (not <$> isEOF) $ do
l <- getLine
t <- getPOSIXTime