Skip to content

Instantly share code, notes, and snippets.

@gildean
gildean / index.html
Last active December 18, 2015 11:49
Ws websocket echo
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>WebSocketTest</title>
<style>
@font-face { font-family: 'Lato'; font-style: normal; font-weight: 300; src: local('Lato Light'), local('Lato-Light'), url(http://themes.googleusercontent.com/static/fonts/lato/v6/KT3KS9Aol4WfR6Vas8kNcg.woff) format('woff'); }
body { font: 130% 'Lato', sans-serif; color:#34495e; background: #ecf0f1; text-shadow: -1px 1px 1px rgba(0,0,0,0.3); padding: 1em 2em; }
#status { position: fixed; top: 0.2em; right: 0.5em }
@gildean
gildean / index.js
Created March 29, 2014 07:37
levelup vs. level-sublevel binary stream
var server = require('http').createServer(handler).listen(function () { console.log(this.address()); });
var fs = require('fs');
var levelup = require('level');
var subLevel = require('level-sublevel');
var dbPath = './test';
if (!fs.existsSync(dbPath)) {
fs.mkdirSync(dbPath);
}
var db = subLevel(levelup(dbPath));
@gildean
gildean / keybase.md
Last active September 15, 2020 07:44

Keybase proof

I hereby claim:

  • I am gildean on github.
  • I am o_k (https://keybase.io/o_k) on keybase.
  • I have a public key whose fingerprint is 1EE9 07C7 50B6 BDF3 27D8 7134 4C4B 6D7F 5184 9FAB

To claim this, I am signing this object:

@gildean
gildean / client.js
Created May 16, 2014 12:42
the simplest https request
var https = require('https');
https.get('https://registry.npmjs.org/', function responseHandler(res) {
var response = '';
res.on('data', function dataCallback(chunk) {
response += chunk;
});
res.on('end', function endCallback() {
var json = JSON.parse(response);
console.log(json);
});
@gildean
gildean / openshift-cheatsheet.md
Created February 1, 2018 10:19 — forked from rafaeltuelho/openshift-cheatsheet.md
My Openshift Cheatsheet
  • Binary Builds
oc new-build --binary=true --name=ola2 --image-stream=redhat-openjdk18-openshift
oc start-build ola2 --from-file=./target/ola.jar --follow
oc new-app 
  • Turn off/on DC triggers to do a batch of changes without spam many deployments
@gildean
gildean / osevents.sh
Last active March 8, 2018 16:14
Stream openshift events to the terminal (probably works with plain kubernetes as well)
#! /bin/bash
if ! oc whoami &> /dev/null; then echo "login to oc first" && exit 1; fi
set -euo pipefail
TOKEN=$(oc whoami -t)
API_SERVER_ADDRESS="https://master/api/v1/watch/events"
# setting LANG gives correct timestamps
LANG=fi_FI.UTF-8
# print timestamp in the middle of the row every 60s
while sleep 60; do