Skip to content

Instantly share code, notes, and snippets.

@kozikow
kozikow / VBox.log
Created September 5, 2016 15:30
Virtual box log
--- ~ » cat ~/.minikube/machines/minikubeVM/minikubeVM/Logs/VBox.log
VirtualBox VM 5.1.4_OSE r110228 linux.amd64 (Aug 22 2016 23:24:52) release log
00:00:00.012258 Log opened 2016-09-05T15:02:18.932291000Z
00:00:00.012259 Build Type: release
00:00:00.012261 OS Product: Linux
00:00:00.012262 OS Release: 4.7.2-1-ARCH
00:00:00.012263 OS Version: #1 SMP PREEMPT Sat Aug 20 23:02:56 CEST 2016
00:00:00.012277 DMI Product Name: 20FBCTO1WW
00:00:00.012282 DMI Product Version: ThinkPad X1 Carbon 4th
@kozikow
kozikow / helm-intellimacs.el
Created September 5, 2016 14:08
Helm settings emulating intellij
;;;; Helm ;;;;
(require 'helm)
(require 'helm-mode)
;; (require 'helm-config)
(helm-mode 1)
(global-set-key (kbd "M-A") 'helm-M-x)
;; (global-set-key (kbd (ht-get intellij-keymap-ht "GotoAction" "M-A")) 'helm-M-x)
(global-unset-key (kbd "M-1"))
@kozikow
kozikow / back.el
Created September 5, 2016 13:49
Back button for emacs
;; TODO Check out helm--push-mark
(defun record-global-position-for-back-button (&rest not-used-args)
"Push mark, and add it to `global-mark-ring'.
This function differs from `push-mark' in that `global-mark-ring'
is always updated."
(let (location (point-marker))
(callf or location (point))
(push-mark location)
;; (when (and (eq consecutives 'limit)
@kozikow
kozikow / airflow_config.go
Last active March 8, 2018 01:53
Airflow config
// Generate airflow config to stdout.
// To start service the from scratch, put this in src/airflow_config/airflow_config.go and run:
// export GOPATH=$(pwd)
// export PATH=$PATH:$GOPATH/bin
// go get k8s.io/client-go/1.4/kubernetes
// go install airflow_config && airflow_config > airflow.yaml
// kubectl create -f airflow.yaml
package main
import (
@kozikow
kozikow / config_gen.go
Created September 1, 2016 15:30
Config generation
package main
import (
"fmt"
"os"
"k8s.io/client-go/1.4/pkg/api/unversioned"
"k8s.io/client-go/1.4/pkg/api/v1"
"k8s.io/client-go/1.4/pkg/apis/extensions/v1beta1"
"k8s.io/client-go/1.4/pkg/runtime"
@kozikow
kozikow / config.go
Last active November 20, 2016 00:07
Prototype generating config from go code
package main
import (
"os"
"k8s.io/client-go/1.4/pkg/api"
"k8s.io/client-go/1.4/pkg/runtime/serializer/json"
"k8s.io/client-go/1.4/pkg/util/intstr"
)
@kozikow
kozikow / web.yaml
Created August 31, 2016 16:54
Kubernetes config of airflow web server
apiVersion: v1
kind: Service
metadata:
name: web
labels:
app: web
spec:
type: LoadBalancer
ports:
- port: 80
@kozikow
kozikow / worker.yaml
Created August 25, 2016 16:48
Worker deployment
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: worker
spec:
replicas: 1
template:
metadata:
labels:
app: airflow
@kozikow
kozikow / py
Created August 12, 2016 00:55
Log exception with stackdriver
def log_exception(e, message_format="{} Exception"):
logger.log_struct({
"message": message_format.format(type(e)),
"exc_info": traceback.format_exc(limit=20).split("\n")
}, severity="ERROR")
@kozikow
kozikow / await_instances.py
Created August 11, 2016 00:52
Awaint instances ready in python
def await_instances_ready(instances: List[str]):
"""
Block until all instances in the list become ready.
Args:
instances: List of instances external IPs.
Raises:
Exception: If we do not own given external IPs.
"""