Skip to content

Instantly share code, notes, and snippets.

@j-keck
j-keck / keybase.md
Last active September 12, 2019 06:00
keybase proof

Keybase proof

I hereby claim:

  • I am j-keck on github.
  • I am jkeck (https://keybase.io/jkeck) on keybase.
  • I have a public key ASCJGDzJpcMANJxwx6mzY2ac_APwI_PCEdQriQD0BFNATgo

To claim this, I am signing this object:

@j-keck
j-keck / notebook-impure.nix
Last active January 27, 2022 13:47
nixos - ipython with octave kernel
with import <nixpkgs> {}; {
pyEnv = stdenv.mkDerivation {
name = "octave-kernel";
buildInputs = [ python27Packages.pip python27Packages.virtualenv python27Packages.jupyter python27Packages.notebook octave gnuplot];
shellHook = ''
if [ ! -d venv ] ; then
virtualenv venv
./venv/bin/pip install octave_kernel
@j-keck
j-keck / journal2pg.pl
Created January 12, 2016 20:29
perl script to send systemd logs in a postgresql db
#!/usr/bin/env perl
#
# save systemd journal logs to a postgres instance
#
#
# * first run with '-init-db' to intialize the database
# * second run to load all logs
# (maybe with '-journalctl-args "-n 1000000"')
# * the following runs inserts only new log entries
#
@j-keck
j-keck / Main.hs
Created October 30, 2015 13:19
haskell wreq: disable certificate validation
{-# LANGUAGE OverloadedStrings #-}
module Main where
import Control.Exception (SomeException, try)
import Control.Lens
import qualified Data.ByteString.Lazy as BL
import Network.Connection (TLSSettings (..))
import Network.HTTP.Client.TLS (mkManagerSettings)
import Network.Wreq
@j-keck
j-keck / Sys.scala
Last active July 12, 2017 20:41
scala: cancelable / async scala.sys.process.Process
/*
The MIT License (MIT)
Copyright (c) 2016 j-keck <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy of this
software and associated documentation files (the "Software"), to deal in the Software
without restriction, including without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to the following conditions:
  1. General Background and Overview
@j-keck
j-keck / network
Created December 12, 2014 15:11
cmdline
# tcpdump
* HTTP GET request
tcpdump -s 0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'
* HTTP POST
tcpdump -s 0 -A 'tcp dst port 80 and (tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x504f5354)'
PROGRAMMING WITH EFFECTS
Graham Hutton, January 2014
Shall we be pure or impure?
The functional programming community divides into two camps:
o "Pure" languages, such as Haskell, are based directly
upon the mathematical notion of a function as a
mapping from arguments to results.
from: http://play.golang.org/p/P5DDZrcXZB
package main
import "fmt"
type Monad interface {
Bind(func(interface{}, Monad) Monad) Monad
Return(interface{}) Monad
}
@j-keck
j-keck / scala
Last active August 29, 2015 14:09
random scala notes
* print generated code: scala -Xprint:typer <scala file>
* compiler phases: scalac -Xshow-phases
* show generated code: scala -Xprint:<phases> (-Xprint:typer or -Xprint:1-14 or -Xprint:all)
* show generated code in gui: scala -Ybrowse:<phases>
scalac options in sbt [source](http://tpolecat.github.io/2014/04/11/scalac-flags.html):