Skip to content

Instantly share code, notes, and snippets.

@nugend
nugend / alias
Created November 14, 2019 22:00
RLWrap Strip Newlines
alias q='rlwrap --multi-line --multi-line-ext=.q --filter=/path/to/remove_newline.pl --no-warnings q'

Keybase proof

I hereby claim:

  • I am nugend on github.
  • I am nugend (https://keybase.io/nugend) on keybase.
  • I have a public key whose fingerprint is 44BB 73BA DAC6 92AE 70DB C682 F989 0EB8 B179 5EC6

To claim this, I am signing this object:

@nugend
nugend / README.md
Last active May 18, 2016 17:52
rlwrap multiline remove newline

Script for removing newlines in multi-line input on rlwrap:

rlwrap --multi-line --filter=/path/to/remove_newline.pl --no-warnings

Use Ctrl-6 (or Ctrl-^ if you prefer) to enter multi-line mode (see rlwrap man page for more info)

// Graylog Collector example configuration.
// URL to REST API of Graylog server this collector registers at
server-url = "http://XXXXX:12900"
// Enable registration with the Graylog server. (enabled by default)
//enable-registration = true
// The id used to identify this collector. Can be either a string which is used as id,
// or the location of a file if prefixed with "file:". If the file does not exist,
@nugend
nugend / locked_app
Created July 15, 2015 16:21
App Lock Exception Marathon
[2015-07-15 12:10:21,156] INFO started processing 4 offers, launching at most 1 tasks per offer and 1000 tasks in total (mesosphere.marathon.tasks.IterativeOfferMatcher$:124)
[2015-07-15 12:10:21,157] INFO Launched 0 tasks on 0 offers, declining 4 (mesosphere.marathon.tasks.IterativeOfferMatcher$:216)
[2015-07-15 12:10:21,546] INFO 10.68.103.51 - - [15/Jul/2015:16:10:20 +0000] "GET /v2/apps HTTP/1.1" 200 4069 "http://nj1dtickdb01:8080/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36" (mesosphere.chaos.http.ChaosRequestLog:15)
[2015-07-15 12:10:21,623] INFO 10.68.103.51 - - [15/Jul/2015:16:10:21 +0000] "GET /v2/deployments HTTP/1.1" 200 2 "http://nj1dtickdb01:8080/" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.132 Safari/537.36" (mesosphere.chaos.http.ChaosRequestLog:15)
[2015-07-15 12:10:23,025] INFO 10.0.3.66 - - [15/Jul/2015:16:10:22 +0000] "GET /v2/apps HTTP/1.1" 200 4069 "http://nj1dvtickr
"""
Copyright (c) 2011, Giuseppe Tribulato.
License: MIT (see http://www.opensource.org/licenses/mit-license.php for details)
"""
import functools
import inspect
import bottle
def check_params(**types):
def decorate(f):
@nugend
nugend / 01-DannoHung.md
Last active August 29, 2015 14:01
What does "Monad" mean?

Monads are complicated because the word "monad" bears too much weight in any discussion about them.

  1. There is a category theoretical concept of a monad. This is largely irrelevant in a practical explanation of monads since Monads are usually talked about in terms of another category theoretical concept called the Kleisli Category or Kleisli Triple. However, if someone starts talking about "monad laws", they're probably referring to the theoretical sense of this.

  2. There is, in Haskell at any rate, a typeclass called the Monad (note the capital "M"). This is mostly important because when a type is an instance of this category, the Haskell do-notation is useful. Aside from that, you can only use the handful of operations that the Monad typeclass implements that you don't have to implement yourself for it to be an instance of Monad.

  3. There are Monad type constructors, such as Maybe, IO, and State. This is where things actually start getting interesting for the practitioner, because each provides a specif

@nugend
nugend / cont.q
Created August 29, 2012 16:07
Sortof-kindof-Continuations
computation:{[k;v]k v}
cAp:{[v;comp];v,comp}
delay:{[comp;v]v,computation[comp]}
.q.cDot:{[l;r];
computation[l],$[1 <> count r; r; computation[r]]
}
compute:{
@nugend
nugend / mfby.q
Created July 20, 2012 18:44
Multi-fby
mfby:{@[count[y]#x[0] . 0#'1 _ x;g;:;'[x 0].(1 _ x)@\:g:value group y]}
@nugend
nugend / getorelse.q
Created July 11, 2012 16:19
Get or Else
.utl.getOrElse:{$[y in key x;x y;z]}