Skip to content

Instantly share code, notes, and snippets.

Avatar

Andy Georges itkovian

View GitHub Profile
View gist:ae833bf62dbbcc8ba2ad
~~~~
filter {
mutate {
add_field => { "[@metadata][target_index]" => "logstash-%{+YYYY.MM.dd}" }
}
if [program] == "jube" {
mutate {
update => { "[@metadata][target_index]" => "longterm-%{+YYYY.Q}" }
}
}
View Aaaargh
f()
{
if (p)
{
// do something
}
else
{
// do something else
}
@itkovian
itkovian / gpfs-get-inode-usage.hs
Created May 31, 2017
Retrieve inode usage for VO filesets from Elasticsearch and print out the relevant usage information
View gpfs-get-inode-usage.hs
#!/usr/bin/env stack
{- stack
--resolver nightly
--install-ghc
runghc
--package bloodhound
--package optparse-applicative
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
View gist:6ae1328a0933cfc32dc873a022eb26cb
handler :: MVar Int -> IO ()
handler s_interrupted = trace "Interrupt received" $ do
r <- readMVar s_interrupted
trace ("value was " ++ show r) $ modifyMVar_ s_interrupted (return . (+1))
{- this prints on the first SIGTERM:
Interrupt received
value was 0
View Main.hs
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Main where
--------------------------------------------------------------------------------
import Control.Applicative ((<$>), (<*>))
import Control.Concurrent.Chan
import Control.Concurrent.Extra
View prs.py
from microbit import *
import random
import radio
bss = [0, 1, 2]
score = 0
radio.on()
radio.config(
power=4,
View m.hs
messageSink success failure messageCount frequency = loop
where
loop = do
v <- await
case v of
Just n -> case n of
Right json -> do
Data.Conduit.yield (encodeNormalisedRsyslog json) $$ success
Data.Conduit.yield (SBS.pack "\n") $$ success
liftIO $ increaseCount (1, 0) messageCount frequency
You can’t perform that action at this time.