Skip to content

Instantly share code, notes, and snippets.

apiVersion: apps/v1
kind: DaemonSet
metadata:
name: haveged
labels:
component: haveged
spec:
selector:
matchLabels:
name: haveged
@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
@sandipchitale
sandipchitale / encryptdecrypt.java
Created July 20, 2019 19:17
Encrypt and decrypt with secret in Java
try {
byte[] secretBytes = "secretsecretsecr".getBytes();
Cipher c = Cipher.getInstance("AES");
SecretKeySpec k =
new SecretKeySpec(secretBytes, "AES");
c.init(Cipher.ENCRYPT_MODE, k);
byte[] encryptedData = c.doFinal("I am carl sagan.".getBytes());
encryptedData[3] = 7;
c.init(Cipher.DECRYPT_MODE, k);
byte[] data = c.doFinal(encryptedData);
@sandipchitale
sandipchitale / allclasses.js
Created July 27, 2019 19:03
One liner to return all classes used by the page. #javascript
[].concat(...[...document.querySelectorAll('*')].map(e=>[...e.classList])).filter((d,i,a)=>a.indexOf(d)==i).sort()
@sandipchitale
sandipchitale / class.directive.js
Last active July 28, 2019 19:51
angularjs directive to monitor class attribute
.directive('class', function() {
return {
restrict: 'A',
link: function(scope, elem) {
var observer = new MutationObserver(function(mutations) {
try {
observer.disconnect();
let e = mutations[0].target;
e.classList.forEach((c) => {
if (c.startsWith('ng-') || c.startsWith('text') || c.startsWith('pre-ep7-')) {
@sandipchitale
sandipchitale / checkport.sh
Last active August 8, 2019 17:15
Check service
until nc -w 3 -z xdb 2014 ; do echo Waiting; sleep 5 ; done
wget -T 1 -O/dev/null -q http://localhost:8080/health > /dev/null 2>&1 ; echo $?
@sandipchitale
sandipchitale / kubernetes-file-system-explorer.ts
Created November 1, 2019 06:10
Kubernetes File System Explorer
'use strict';
import * as vscode from 'vscode';
import * as k8s from 'vscode-kubernetes-tools-api';
class FileNode implements k8s.ClusterExplorerV1.Node {
private name: string;
constructor(name: string) {
@sandipchitale
sandipchitale / JDKSLLTLS
Created November 4, 2019 06:17
Docs for JDK SSL/TLS
https://docs.oracle.com/javase/10/security/java-secure-socket-extension-jsse-reference-guide.htm#JSSEC-GUID-93DEEE16-0B70-40E5-BBE7-55C3FD432345
@sandipchitale
sandipchitale / build-task-graph.gradle
Created May 17, 2020 04:56
Print Gradle Task Graph Plugin
apply plugin: PrintTaskExecGraphPlugin
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.execution.TaskExecutionGraph
import org.gradle.api.logging.Logger
import org.gradle.api.logging.Logging
import org.gradle.execution.plan.ExecutionPlan
import org.gradle.execution.plan.TaskNode
@sandipchitale
sandipchitale / ruler.html
Last active June 6, 2020 08:05
Rule overlay
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Ruler</title>
<style>
html,body {
width: 100vw;
height: 100vh;