Skip to content

Instantly share code, notes, and snippets.

@sandipchitale
sandipchitale / getpodsusingcurl.sh
Created July 13, 2019 00:14
Talk to API server from inside the container. #kubernetes
curl -ik \
-H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
https://kubernetes.default.svc.cluster.local/api/v1/namespaces/default/pods
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: haveged
labels:
component: haveged
spec:
selector:
matchLabels:
name: haveged
@sandipchitale
sandipchitale / nfs-client-provisioner.yml
Created June 20, 2019 20:58
NFS Server + dynamic NFS Client provisioner
---
kind: ServiceAccount
apiVersion: v1
metadata:
name: nfs-client-provisioner
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: nfs-client-provisioner-runner
<html>
<head>
<style>
html,
body {
top: 0;
left: 0;
}
<html>
<head>
<style>
html,
body {
top: 0;
left: 0;
}
@sandipchitale
sandipchitale / console.table.js
Created March 13, 2019 17:52
Highlight elements with id's (or other selectors), display in table form in Chrome Devtools Console.
console.table(([].slice.call(document.querySelectorAll("[id]"))).map((e) => { e.style.outline = '1px solid red'; e.title = (e.id + ' ' + e.title); return {'id': e.id, 'element': e} }))
@sandipchitale
sandipchitale / componentLifecycleMethodOrderRule.ts
Last active January 5, 2020 22:56
TSLInt rule that ensures that a @component has constructor, ngOnInit and ngOnDestroy in correct order.
/**
* TSLInt rule that ensures that a @Component has constructor, ngOnInit and ngOnDestroy in correct order.
*/
import {
SourceFile, ClassDeclaration, MethodDeclaration,
createNodeArray,
isCallExpression,
isIdentifier,
Decorator,
SyntaxKind
@sandipchitale
sandipchitale / angular.json
Last active December 7, 2018 23:09
Snippet for bootstrap.js stuff
[
"node_modules/jquery/dist/jquery.js",
"node_modules/popper.js/dist/umd/popper.js",
"node_modules/bootstrap/dist/js/bootstrap.js"
]
@sandipchitale
sandipchitale / winpath.sh
Last active July 29, 2022 17:28
Show Windows path of PWD in WSL. Example usage to launch explorer: /mnt/c/Windows/explorer.exe `winpwd`
#!/bin/bash
# set -x
LXSS_PATH="$(/mnt/c/Windows/System32/cmd.exe /C echo %LOCALAPPDATA% | tr -d '\f\n\r')\\lxss"
# Show help
if [[ "$1" == "--help" ]] ; then
echo "$0 [--help] [absolute or relative path]"
exit
fi
@sandipchitale
sandipchitale / ctoroverride.js
Last active September 14, 2018 22:17
Generic constructor override with example of Date
(function (context, constructorName, special) {
var Original;
Original = context[constructorName];
context[constructorName] = function PatchedOriginal() {
var args;
args = Array.prototype.slice.call(arguments);
var returnObject;
if (special) {
returnObject = special(Original, PatchedOriginal, args);
}