Skip to content

Instantly share code, notes, and snippets.

@vidhill
vidhill / index.js
Created March 1, 2016 14:00
Quick and dirty example of workaround to display css class body from SassDoc
//
var passClassBody = function(myContext){
myContext.data.filter(function(item){
if( item.context.type === 'css'){
item.context.code = '\n' + item.context.value + '\n'; // copy value over to code, so that it is outputted as regular sass is
}
return item;
@vidhill
vidhill / minikube.log
Created March 23, 2017 13:04
Minikube STDOUT error starting up
I0323 12:51:28.766196 11604 notify.go:112] Checking for updates...
Starting local Kubernetes cluster...
Starting VM...
I0323 12:51:28.998922 11604 downloader.go:56] Not caching ISO, using https://storage.googleapis.com/minikube/iso/minikube-v1.0.7.iso
SSH-ing files into VM...
Setting up certs...
I0323 12:52:10.089394 11604 cluster.go:241] Setting up certificates for IP: %s 192.168.99.103
Starting cluster components...
I0323 12:52:10.593043 11604 cluster.go:174]
if which systemctl 2>&1 1>/dev/null; then
W0323 16:17:08.207564 5282 root.go:157] Error reading config file at /home/dhill/.minikube/config/config.json: open /home/dhill/.minikube/config/config.json: no such file or directory
I0323 16:17:08.208195 5282 notify.go:112] Checking for updates...
Starting local Kubernetes cluster...
Starting VM...
Downloading Minikube ISO
89.24 MB / 89.24 MB [===============================================] 100.00% 0
SSH-ing files into VM...
Downloading localkube binary
77.35 MB / 77.35 MB [===============================================] 100.00% 0
Setting up certs...
This file has been truncated, but you can view the full file.
-- Logs begin at Thu 2017-03-23 16:57:51 UTC, end at Thu 2017-03-23 17:12:12 UTC. --
Mar 23 17:01:57 minikube systemd[1]: Starting Localkube...
Mar 23 17:01:57 minikube localkube[3275]: unknown flag: --apiserver-name
Mar 23 17:01:57 minikube localkube[3275]: Usage of /usr/local/bin/localkube:
Mar 23 17:01:57 minikube localkube[3275]: --allow_verification_with_non_compliant_keys value Allow a SignatureVerifier to use keys which are technically non-compliant with RFC6962.
Mar 23 17:01:57 minikube localkube[3275]: --alsologtostderr value log to standard error as well as files
Mar 23 17:01:57 minikube localkube[3275]: --apiserver-address value The address the apiserver will listen securely on (default 0.0.0.0)
Mar 23 17:01:57 minikube localkube[3275]: --apiserver-insecure-address value The address the apiserver will listen insecurely on (default 127.0.0.1)
Mar 23 17:01:57 minikube localkube[3275]: --apiserver
@vidhill
vidhill / generator-wrapper.js
Created October 9, 2017 13:26
Function to automatically call .next on creation of a generator function
const wrapGen = myGenerator => {
return function(...passedArgs){
const iter = myGenerator(...passedArgs);
iter.next(); // the black hole call
return iter;
}
}
export default wrapGen
@vidhill
vidhill / kube-get-pods-service.sh
Created June 1, 2018 20:55
Kubectl: workaround to get a list of pods for a service
#!/bin/bash
if [ "$1" != "" ]; then
echo "Get pods in service: $1"
else
echo "Service blank"
echo "Pass the target service"
exit 1
fi
@vidhill
vidhill / reduce.java
Last active November 9, 2018 13:46
Java reduce/collection, the many ways to skin a cat
// Option A
Integer totalFixedRateResultCount = fixedRateCounts
.stream()
.reduce(0, (aggValue, current) -> {
Integer value = (Integer) current.getValue();
return aggValue + value;
}, (aLong1, aLong2) -> aLong1);
// Option B
Integer totalFixedRateResultCount = fixedRateCounts
@vidhill
vidhill / Dockerfile
Created July 26, 2017 22:36
node-gyp within Docker
FROM node:6.9.1-alpine
MAINTAINER vidhill
RUN apk add --no-cache add python build-base # build base includes g++ and gcc and Make
COPY service.tgz /service/
RUN cd /service && tar xvf service.tgz && rm service.tgz && cd package
RUN cd /service/package && npm install
@vidhill
vidhill / service.js
Last active September 6, 2019 19:09
Please avoid this pattern
import { someApiCall } from './'
const myService = async function(parameter, passedObject) {
const restResponse = await someRestCall(parameter);
passedObject.details = restResponse[0];
return {
content: restResponse.foo,
const doFoo = (passedObj) => {
passedObj.foo = true;
passedObj.bar = false;
return {
cat: 'meow',
passedObj
};
}