Skip to content

Instantly share code, notes, and snippets.

@navidshaikh
navidshaikh / gist:4147217
Created November 26, 2012 08:36 — forked from syntagmatic/gist:2202660
Export CSV with Javascript
// assumes variable data, which is a homogenous collection of objects
// get keys
var keys = _.keys(data[0]);
// convert to csv string
var csv = keys.join(",");
_(data).each(function(row) {
csv += "\n";
csv += _(keys).map(function(k) {

Setup TLS-Enabled-Daemon from CDK and Connect to Eclipse

NEW VERSION OF THIS DOC https://github.com/navidshaikh/testing-adb

Bex has done a better job in building up the context and outlining the idea [here] (https://gist.github.com/bexelbie/35f421ee247c7621c0d0) . Goal here is to configure a TLS enabled Docker docker daemon running over TCP from inside CDK and configure client at Eclipse to be able to connect to it.

In order to get configure CDK + Eclipse

  1. docker daemon inside CDK has to run over TCP (as well, if running on local unix socket) - This need required certs to be generated inside CDK and updating the docker daemon config and restarting service.
  2. Required client side certs has to be copied over to host (from guest) for clients to connect
  3. Port at which docker inside CDK running need to be mapped at host machine port for client to easily connect
#!/usr/bin/env python2
import sys
class Node(object):
def __init__(self, value):
self.mid = value
self.left = None
self.right = None
@navidshaikh
navidshaikh / knative terms
Last active March 27, 2019 10:31
Terms used in kantive context
Serving:
- stable-window: After a defined time of idleness when no request coming to revision.
- inactive-revision: Revision's state after `stable-window`.
- scale-to-zero-grace-period: The time an inactive revision is left running before it's scaled to zero.
Facts:
- After `stable-window` is lapsed, all the `inactive-revisions` now points to `activator`.
@navidshaikh
navidshaikh / traffic_demo.sh
Created August 15, 2019 13:57
sample demo script
set x
function nq() {
printf "\n"
read -p "Next?(y/n): " next
if [ $next != "y" ]
then
exit 1
fi
oc create -f https://github.com/tektoncd/pipeline/releases/download/v0.6.0/release.yaml
# wait for tekton to setup
oc new-project tutorial
oc create serviceaccount pipeline
oc adm policy add-scc-to-user privileged -z pipeline
oc adm policy add-role-to-user edit -z pipeline
# install buildah task
oc create -f https://raw.githubusercontent.com/tektoncd/catalog/master/buildah/buildah.yaml
@navidshaikh
navidshaikh / crc_setup.txt
Last active January 30, 2020 16:20
Get CRC running on local machine
1 - Get CRC:
https://github.com/code-ready/crc/releases
excerpts:
Downloads are available at:
https://mirror.openshift.com/pub/openshift-v4/clients/crc/1.4.0/ .
To use these binaries, please follow the instructions at https://cloud.redhat.com/openshift/install/crc/installer-provisioned
to obtain the needed pull-secret.
(download the pull-secret in your machine in a file)
2 - Extract the tar downloaded (there is a crc binary in there, add the extracted dir to your $PATH)
- apiVersion: serving.knative.dev/v1
kind: Route
metadata:
annotations:
serving.knative.dev/creator: [email protected]
serving.knative.dev/lastModifier: [email protected]
creationTimestamp: "2020-07-31T05:10:16Z"
finalizers:
- routes.serving.knative.dev
generation: 1
@navidshaikh
navidshaikh / upgrade.log
Last active October 27, 2020 06:51
knative_operator_during_upgrade
➜ client git:(master) oc logs -f knative-operator-757cf7555f-lrsr8 -n openshift-serverless
2020/10/27 06:44:11 Registering 2 clients
2020/10/27 06:44:11 Registering 3 informer factories
2020/10/27 06:44:11 Registering 3 informers
2020/10/27 06:44:11 Registering 2 controllers
{"level":"info","ts":"2020-10-27T06:44:11.174Z","caller":"logging/config.go:111","msg":"Successfully created the logger."}
{"level":"info","ts":"2020-10-27T06:44:11.174Z","caller":"logging/config.go:112","msg":"Logging level set to debug"}
{"level":"info","ts":"2020-10-27T06:44:11.174Z","caller":"logging/config.go:79","msg":"Fetch GitHub commit ID from kodata failed","error":"open /var/run/ko/HEAD: no such file or directory"}
{"level":"info","ts":"2020-10-27T06:44:11.174Z","logger":"knative-operator","caller":"profiling/server.go:59","msg":"Profiling enabled: false"}
{"level":"info","ts":"2020-10-27T06:44:11.180Z","logger":"knative-operator","caller":"sharedmain/main.go:197","msg":"knative-operator will not run in leader-elected mode"}
@navidshaikh
navidshaikh / knative_openshift.log
Created October 27, 2020 07:16
1.9to1.10upgrade
client git:(master) oc logs knative-openshift-99d9d6445-9rfj2 -n openshift-serverless
{"level":"info","ts":"2020-10-27T06:44:20.331Z","logger":"cmd","msg":"Go Version: go1.13.8"}
{"level":"info","ts":"2020-10-27T06:44:20.331Z","logger":"cmd","msg":"Go OS/Arch: linux/amd64"}
{"level":"info","ts":"2020-10-27T06:44:20.331Z","logger":"cmd","msg":"Version of operator-sdk: v0.10.1"}
{"level":"info","ts":"2020-10-27T06:44:20.332Z","logger":"leader","msg":"Trying to become the leader."}
{"level":"info","ts":"2020-10-27T06:44:20.492Z","logger":"leader","msg":"Found existing lock","LockOwner":"knative-openshift-6dcd97b479-6m6l5"}
{"level":"info","ts":"2020-10-27T06:44:20.499Z","logger":"leader","msg":"Not the leader. Waiting."}
{"level":"info","ts":"2020-10-27T06:44:21.652Z","logger":"leader","msg":"Not the leader. Waiting."}
{"level":"info","ts":"2020-10-27T06:44:24.034Z","logger":"leader","msg":"Became the leader."}
{"level":"info","ts":"2020-10-27T06:44:24.172Z","logger":"cmd","msg":"Registering Components."}