Skip to content

Instantly share code, notes, and snippets.

View itkovian's full-sized avatar

Andy Georges itkovian

  • Ghent University
  • Oostende, BELGIUM
View GitHub Profile
@itkovian
itkovian / m.hs
Created April 5, 2019 09:04
messageSink
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
from microbit import *
import random
import radio
bss = [0, 1, 2]
score = 0
radio.on()
radio.config(
power=4,
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
module Main where
--------------------------------------------------------------------------------
import Control.Applicative ((<$>), (<*>))
import Control.Concurrent.Chan
import Control.Concurrent.Extra
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
@itkovian
itkovian / gpfs-get-inode-usage.hs
Created May 31, 2017 21:48
Retrieve inode usage for VO filesets from Elasticsearch and print out the relevant usage information
#!/usr/bin/env stack
{- stack
--resolver nightly
--install-ghc
runghc
--package bloodhound
--package optparse-applicative
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedStrings #-}
f()
{
if (p)
{
// do something
}
else
{
// do something else
}
~~~~
filter {
mutate {
add_field => { "[@metadata][target_index]" => "logstash-%{+YYYY.MM.dd}" }
}
if [program] == "jube" {
mutate {
update => { "[@metadata][target_index]" => "longterm-%{+YYYY.Q}" }
}
}
extern crate rand;
use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
let secret_number = rand::thread_rng().gen_range(1,101);
@itkovian
itkovian / gist:c03abe93bf3553f0a529
Created July 28, 2015 08:49
Installed GHC expressions from nixpkgs
➜ /Users/ageorges/nixpkgs git:(master) $ nix-store --gc --print-live | grep ghc
finding garbage collector roots...
determining live/dead paths...
/nix/store/0c0x6ikdd91xnv8ad5qg1cnjllcya6l1-ghc-7.4.2-x86_64-apple-darwin.tar.bz2.drv
/nix/store/0w52i4qmn9h3n9nh4az5qld25pfq80mg-ghc-7.8.4-src.tar.xz.drv
/nix/store/37d4r09fx6ipgp3kla9kpjr8krvqpnp6-ghc-7.10.1
/nix/store/3z09cx6hi7m0xpnjmm5c7pz35r1j3a29-ghc-7.8.4.drv
/nix/store/57w4xa43g7ilkdjd7mplrn8l3pvmyklf-ghc-paths-nix.patch
/nix/store/6bpp1dda46rv107j5zszhlv03gdbp90c-ghc-paths-0.1.0.9.tar.gz.drv
/nix/store/8qqqq11g317x8nc6js7vl72r320irchb-haskell-ghc-paths-0.1.0.9

Keybase proof

I hereby claim:

  • I am Itkovian on github.
  • I am itkovian (https://keybase.io/itkovian) on keybase.
  • I have a public key whose fingerprint is 1B82 264B 2D1C 74DF 0703 6F6A B88B 1889 BCBC 7CD8

To claim this, I am signing this object: