This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module(load="mmjsonparse") | |
set $.computed_pri = $pri; | |
# TODO: Better ISO-8601 capture (e.g. this one doesn't handle some leap second representations). | |
set $.inner_level = re_extract($msg, '^ *time="[1-9][0-9]{3,}-(1[12]|0[1-9])-(3[01]|[12][0-9]|0[1-9])T(2[0-3]|[01][0-9]):([0-5][0-9]):([0-5][0-9])Z" +level=([a-z]+)', 0, 6, ''); | |
if ($.inner_level == '') then { | |
action(type="mmjsonparse" cookie="") | |
if $parsesuccess == 'OK' then set $.inner_level = $!level; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Versions of helm commands that usefully replace `find-file-other-window' | |
;;; and `switch-to-buffer-other-window'. They work by replacing the default | |
;;; action and calling the actual helm functions. | |
(defun as-alist-move-cdr-first (alist cdr-value) | |
"Returns a copy of alist, but with the (first) element with CDR cdr-value at its head." | |
(let ((first (rassoc cdr-value alist))) | |
(if first | |
(cons first (map-remove #'(lambda (key value) (equal value cdr-value)) alist)) | |
alist))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// DO NOT SUBMIT: Code for teaching ariels to feed state back through | |
// RxJS. | |
import { test } from 'ava'; | |
import * as Rx from 'rxjs'; | |
import { List } from 'immutable-sorted'; | |
class State { | |
private constructor(private lastN: List<number>, private num: number) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Leak memory using Rx.bufferTime. | |
import * as Rx from 'rxjs'; | |
import * as op from 'rxjs/operators'; | |
declare var window: any; | |
function getHeap() { | |
return process.memoryUsage().heapUsed; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
# Generates a control sequence for resizing a window. These are all | |
# described at https://invisible-island.net/xterm/ctlseqs/ctlseqs.html. | |
import click | |
@click.command() | |
@click.option('--rows', default=60, help='Number of rows.') | |
@click.option('--cols', default=80, help='Number of columns.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as baseRequest from 'request-promise-native'; | |
import { StatusCodeError } from 'request-promise-native/errors'; | |
import { concurrently, backoff } from '@binaris/nodeutils'; | |
const orgId = process.env.ATLAS_ORG_ID | |
const publicKey = process.env.ATLAS_PUBLIC_KEY; | |
const privateKey = process.env.ATLAS_PRIVATE_KEY; | |
const concurrency = parseInt(process.env.ATLAS_CONCURRENCY || '30', 10); | |
const request = baseRequest.defaults({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((10*(9*8*(7-6)-5)+4)*3-2)*1 | |
((10*(9*8*(7-6)-5)+4)*3-2)/1 | |
((10*(9*8-(7-6)*5)+4)*3-2)*1 | |
((10*(9*8-(7-6)*5)+4)*3-2)/1 | |
((10*(9*8/(7-6)-5)+4)*3-2)*1 | |
((10*(9*8/(7-6)-5)+4)*3-2)/1 | |
((10*9+8)*7-(6+5*4/3))*(2+1) | |
((10*9+8)*7-6-5*4/3)*(2+1) | |
((10*9+8)/7+6)*(5*4*(3+2)+1) | |
((10*9+8*(7*(6+5)-4))*3-2)*1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://www.typescriptlang.org/play/#code/C4TwDgpgBAshwAsD2ATA0hEBnA8gJwDkIA3CPAHgBUA+KAXigG8AoKNqAbTSgEsA7KAGtMSAGZRKAXQBcErpKgQAHsAh8UWKADEArnwDGwHkgEB+KN1l8SZANzMAvs1CRY8ZOkxYqtBnESoGNj4RKQUNBzCIGISkvbM-Kp4ogCG+tAAkkys7HxWOgC2AEZ2OWyiABQp+cVkAJSyWMB4-ADm9uxQrRUNUMRIPCj2Ti7QWvRuAZ7Y5BnUtmwA9ItQAESiq1AAPmutq8xAA | |
type MethodKeysOrNever<T> = { | |
[K in keyof T]: T[K] extends Function ? K : never; | |
} | |
type MethodKeys<T> = MethodKeysOrNever<T>[keyof T]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
"time" | |
"golang.org/x/exp/rand" | |
"gonum.org/v1/gonum/stat/distuv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Define "r o" (an "o" suffix) for "magit rebase onto origin/master" | |
(require 'magit) | |
(transient-define-suffix as-magit-rebase-onto-origin-master (args) | |
"Rebase the current branch onto origin/master. | |
TODO(ariels): Make it better and also document it." | |
:if 'magit-get-current-branch | |
:description "origin/master" | |
(interactive (list (magit-rebase-arguments))) | |
(magit-git-rebase "origin/master" args)) |
OlderNewer