Skip to content

Instantly share code, notes, and snippets.

@kadel
kadel / app.py
Created November 8, 2018 20:11
python example
import MySQLdb
import os
import time
print("environment dump")
print("----------------")
for k,v in os.environ.items():
print(k, "=", v)
print("----------------")
apiVersion: image.openshift.io/v1
kind: ImageStream
metadata:
name: openjdk18
spec:
lookupPolicy:
local: false
tags:
- annotations:
tags: builder
@kadel
kadel / openshift-oauth.go
Created August 17, 2018 16:42
Get OAuth authorization token form OpenShift
package main
import (
"context"
"crypto/tls"
"fmt"
"io/ioutil"
"net/http"
"net/url"
@kadel
kadel / cat.py
Created August 3, 2018 09:42
Transaction Categorizer
from categorizer import Categorizer
desc = "Amazon web services"
amount = 99
categorizer = Categorizer("config.yaml")
account_expense = categorizer.getAccount(desc, amount)
print(account_expense)
@kadel
kadel / dc.yaml
Created July 25, 2018 13:19
Supervisor with S2I image
apiVersion: apps.openshift.io/v1
kind: DeploymentConfig
metadata:
name: pod-with-supervisord
labels:
app: myapp
spec:
replicas: 1
template:
metadata:
diff --git a/cmd/push.go b/cmd/push.go
index 636dc8c..07b031d 100644
--- a/cmd/push.go
+++ b/cmd/push.go
@@ -4,6 +4,7 @@ import (
"fmt"
"net/url"
"os"
+ "path/filepath"
@kadel
kadel / Dockerfile
Last active June 27, 2018 18:17
supervisord injection via initContainer and shared volume
FROM centos
ENV SUPERVISORD_DIR /opt/supervisord
RUN mkdir -p ${SUPERVISORD_DIR}/conf ${SUPERVISORD_DIR}/bin
ADD supervisor.conf ${SUPERVISORD_DIR}/conf/
ADD https://github.com/ochinchina/supervisord/releases/download/v0.5/supervisord_0.5_linux_amd64 ${SUPERVISORD_DIR}/bin/supervisord
RUN chgrp -R 0 ${SUPERVISORD_DIR} && \
@kadel
kadel / btrfs-nixos-install.sh
Last active May 26, 2018 13:49 — forked from samdroid-apps/btrfs-nixos-install.sh
nixos install (boot + btrfs) - virtualbox
mkfs.vfat -n BOOT /dev/sda1
mkfs.btrfs -L root /dev/sda2
mount -t btrfs /dev/sda2 /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o subvol=nixos /dev/sda2 /mnt/
btrfs subvolume create /mnt/var
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/tmp
package occlient
import (
"fmt"
"io/ioutil"
"os"
"reflect"
"testing"
routev1 "github.com/openshift/api/route/v1"
package main
import (
"fmt"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
corev1client "k8s.io/client-go/kubernetes/typed/core/v1"
"k8s.io/client-go/tools/clientcmd"
)