Skip to content

Instantly share code, notes, and snippets.

View lpeterse's full-sized avatar

Lars Petersen lpeterse

  • Flensburg, Germany
View GitHub Profile
./configure --with-security-modules=tsm --with-transports="SSH UDP" --with-systemd --prefix="/usr"
make
sudo make install
% snmpget ssh:localhost:22 1.3.6.1.4.1.2021.10.1.3.1
UCD-SNMP-MIB::laLoad.1 = STRING: 0.35
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jYmMAAAAGYmNyeXB0AAAAGAAAABDoZKFgIh
SZDqyG7Ql7NKPMAAAAEAAAAAEAAAAzAAAAC3NzaC1lZDI1NTE5AAAAIBBKQsqWIjLy/hrm
CMuiPKlwpHtzHwHsdit/JFU9DCg4AAAAoCiYqeiXjicdeesCkF4mzwXSjX4vIuliAXKFFo
mf3McjjfrzM4nduswKftoQ6byGsBN8Spx+u5YJrrRAPbZA27npE42H4w1uj6hKpnDEdUMT
9tJA+1Md+PUP/9vs3hqtF8aTVVBeOPDalQJYqOCOVKhu7pHpKCXiK1AC3f1WAw5f+Oul18
CLBz4QYpty8pnO27U+dx8wr6kETJ9YX3L7p1A=
-----END OPENSSH PRIVATE KEY-----

Merges

  • DON'T.
  • Mergen (außer Fast-Forward) ist zu vermeiden, weil es die Nachvollziehbarkeit von Änderungen schwierig macht (alles grün/rot in Merge-commits).

Entwicklung von Features

  • master repräsentiert immer den Stand, der in PROD läuft (außer während eines Deployments). Die meiste Zeit ist der letzte Commit auf diesem Branch also Back to snapshot.
@lpeterse
lpeterse / foobar.hs
Created January 17, 2018 15:30
Incrementally reading binary data
foobar :: LBS.ByteString -> IO (UArray Int Word32)
foobar lbs = case B.pushChunk (B.runGetIncremental B.get) a of
B.Done a' _ bounds -> do
arr <- MA.newArray_ bounds -- ....
initialize 0 (fromIntegral len - 1) arr a' as
A.freeze arr
_ -> error "won't happen"
where
@lpeterse
lpeterse / README.md
Last active January 14, 2018 20:47
ANSI terminal interface in Haskell

Goal

A library that..

  • offers a portable interface for writing interactive terminal applications
  • favours portability and simplicity over performance and features
  • supports most modern software terminals (not the old tube things in the museum)
  • behaves the same on all ANSI-compliant terminals (+ extra code for Windows i.e. via ansi-terminal)
  • has a minimal set of dependencies
  • does not use terminfo
@lpeterse
lpeterse / stm-example.hs
Created December 22, 2017 08:28
STM example
module Main where
import Control.Concurrent
import Control.Concurrent.Async
import Control.Concurrent.STM.TChan
import Control.Monad
import Control.Monad.STM
main :: IO ()
main = do
@lpeterse
lpeterse / README.md
Last active May 29, 2019 21:29
runit

Dies ist das Kommando, um runsv zu starten und zu detachen:

$ setsid sh -c 'exec ./runsv foobar </dev/null &>/dev/null'
$ pstree
systemd─┬─...
        ├─runsv─┬─gnurp───4*[{gnurp}]
        │       └─svlogd
@lpeterse
lpeterse / SocketClass.hs
Created October 1, 2016 22:40
A class for socket programming
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
module Main where
import Control.Exception
import qualified Data.ByteString as BS
import qualified Data.ByteString.Lazy as BSL
main :: IO ()
main = return ()
@lpeterse
lpeterse / Broadcast.hs
Created September 3, 2016 19:43
A simple (unbounded) broadcast implementation using MVar
module Control.Concurrent.Broadcast
( Broadcast ()
, BroadcastListener ()
, newBroadcast
, broadcast
, terminate
, listen
, accept
) where
@lpeterse
lpeterse / README.md
Created August 23, 2016 16:12
Globbing

Globbing