Skip to content

Instantly share code, notes, and snippets.

View kans's full-sized avatar

Matt Kaniaris kans

View GitHub Profile
@kans
kans / generator.ts
Last active February 22, 2022 18:55
generator consumer/resumer in typescript
import * as _ from "lodash";
type AsyncTask<T> = () => Promise<T>;
type AsyncTaskGenerator<T=unknown> = () => AsyncGenerator<AsyncTask<T>, T, Promise<T>>;
const start = Date.now() / 1000
const time = () => ((Date.now() / 1000) - start).toFixed(2);
const assert = (x, y) => {
if (x !== y) {
console.error(`g: ${x} !== ${y}`);
@kans
kans / partitions.py
Last active June 12, 2018 19:40
total unique partitions for integer N of smaller integers
#https://en.wikipedia.org/wiki/Partition_%28number_theory%29#Intermediate_function#Restricted_part_size_or_number_of_parts
def pkn(n, k):
if n == 0 and k == 0:
return 1
if n <= 0:
return 0
if k <= 0:
return 0
Starting matchbox
+ cd /jenkins/workspace/tectonic-installer_PR-1408-ZXQMI5576QYQ5KT637IO36DLHWHDY5PILWEKU5N5UGDC4OJYVUTA/tests/smoke/bare-metal/../../../matchbox
+ sudo -S -E ./scripts/devnet create
Most examples use CoreOS stable 1353.7.0. You may wish to download it with './scripts/get-coreos stable 1353.7.0'.
Starting matchbox
@kans
kans / tree
Created July 11, 2017 17:31
tf cluster tree
.
├── config.tf
├── generated
│   ├── bootkube.sh
│   ├── bootstrap-experimental
│   │   └── bootstrap-etcd.yaml
│   ├── bootstrap-manifests
│   │   ├── bootstrap-apiserver.yaml
│   │   ├── bootstrap-controller-manager.yaml
│   │   └── bootstrap-scheduler.yaml
2014-03-07 16:08:25,056 [ 233275] INFO - #floobits.utilities.Flog - Got _on_patch
2014-03-07 16:08:25,058 [ 233277] INFO - #floobits.utilities.Flog - Patched main.java
2014-03-07 16:08:25,058 [ 233277] INFO - #floobits.utilities.Flog - Spent 2 in ui thread
2014-03-07 16:08:25,059 [ 233278] INFO - #floobits.utilities.Flog - spent 3 getting lock
2014-03-07 16:08:25,198 [ 233417] INFO - #floobits.utilities.Flog - spent 1 getting lock
2014-03-07 16:08:25,198 [ 233417] INFO - #floobits.utilities.Flog - Got _on_patch
2014-03-07 16:08:25,200 [ 233419] INFO - #floobits.utilities.Flog - Patched main.java
2014-03-07 16:08:25,200 [ 233419] INFO - #floobits.utilities.Flog - Spent 2 in ui thread
2014-03-07 16:08:25,201 [ 233420] INFO - #floobits.utilities.Flog - spent 3 getting lock
2014-03-07 16:08:25,300 [ 233519] INFO - #floobits.utilities.Flog - spent 0 getting lock
@kans
kans / gist:9244851
Created February 27, 2014 05:22
Change Listener for Atom
module.exports = {
floobitsView: null,
activate: function(state) {
atom.workspaceView.eachEditorView(function(e) {
var editor = e.getEditor();
editor.on("contents-modified", function(){
process.nextTick(function(){
console.log('modified')
})
om.intellij.openapi.editor.impl.RangeHighlighterTree@2d33ff20; this: com.intellij.openapi.editor.impl.RangeHighlighterTree@30b2a50f: com.intellij.openapi.editor.impl.RangeHighlighterTree@2d33ff20; this: com.intellij.openapi.editor.impl.RangeHighlighterTree@30b2a50f
java.lang.AssertionError: com.intellij.openapi.editor.impl.RangeHighlighterTree@2d33ff20; this: com.intellij.openapi.editor.impl.RangeHighlighterTree@30b2a50f
at com.intellij.openapi.editor.impl.IntervalTreeImpl.checkBelongsToTheTree(IntervalTreeImpl.java:894)
at com.intellij.openapi.editor.impl.RangeMarkerTree.checkBelongsToTheTree(RangeMarkerTree.java:140)
at com.intellij.openapi.editor.impl.RangeMarkerTree.checkBelongsToTheTree(RangeMarkerTree.java:38)
at com.intellij.openapi.editor.impl.IntervalTreeImpl.removeInterval(IntervalTreeImpl.java:924)
at com.intellij.openapi.editor.impl.MarkupModelImpl.removeHighlighter(MarkupModelImpl.java:179)
at floobits.handlers.FlooHandler$7.on_document(FlooHandler.java:440)
at floobits.handlers.DocumentFe
null
java.lang.reflect.InvocationTargetException
at sun.reflect.GeneratedMethodAccessor112.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.a(FileDocumentManagerImpl.java:144)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.access$000(FileDocumentManagerImpl.java:84)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl$1.invoke(FileDocumentManagerImpl.java:111)
at com.sun.proxy.$Proxy19.beforeDocumentSaving(Unknown Source)
at com.intellij.openapi.fileEditor.impl.FileDocumentManagerImpl.a(FileDocumentManagerImpl.java:419)
@kans
kans / gist:8566900
Created January 22, 2014 20:35
valground
==22908== Memcheck, a memory error detector
==22908== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==22908== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==22908== Command: vim
==22908== Parent PID: 22697
==22908==
==22908== Invalid read of size 4
==22908== at 0x57257E2: PyObject_Free (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==22908== by 0x56BEA8A: ??? (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
==22908== by 0x57164C1: ??? (in /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0)
__LOG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) b was renamed
__LOG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) created /home/kans/test/asdf/b
__DEBUG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) Initializing ignores for /home/kans/test/asdf
__DEBUG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) Initializing ignores for /home/kans/test/asdf
__LOG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) buf b doesn't exist. creating...
__DEBUG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) writing to conn: {"buf":"","encoding":"utf8","md5":"d41d8cd98f00b204e9800998ecf8427e","path":"b","name":"create_buf"}
__LOG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) b was changed
__DEBUG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) Initializing ignores for /home/kans/test/asdf
__DEBUG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) Initializing ignores for /home/kans/test/asdf
__LOG__ Tue Dec 03 2013 01:04:52 GMT+0000 (UTC) buf b doesn't exist. creating...