Skip to content

Instantly share code, notes, and snippets.

View thiyagaraj's full-sized avatar

Thiyagaraj Krishna thiyagaraj

View GitHub Profile
@thiyagaraj
thiyagaraj / README.md
Created December 23, 2018 03:48 — forked from squidpickles/README.md
Multi-platform (amd64 and arm) Kubernetes cluster

Multiplatform (amd64 and arm) Kubernetes cluster setup

The official guide for setting up Kubernetes using kubeadm works well for clusters of one architecture. But, the main problem that crops up is the kube-proxy image defaults to the architecture of the master node (where kubeadm was run in the first place).

This causes issues when arm nodes join the cluster, as they will try to execute the amd64 version of kube-proxy, and will fail.

It turns out that the pod running kube-proxy is configured using a DaemonSet. With a small edit to the configuration, it's possible to create multiple DaemonSets—one for each architecture.

Steps

Follow the instructions at https://kubernetes.io/docs/setup/independent/create-cluster-kubeadm/ for setting up the master node. I've been using Weave Net as the network plugin; it see

@thiyagaraj
thiyagaraj / README.MD
Created August 6, 2018 18:34 — forked from samdenty/README.MD
VS Code CSS addition to increase readability on file tree.

How to install

Custom CSS plugin

Install the custom CSS plugin, then make a file on your computer that will hold your custom CSS, I like to make one in my home directory called ~/.vscodestyles.css and then add the CSS into it.

Once done, open your command palette and select enable custom CSS and JS

@thiyagaraj
thiyagaraj / git_submodules.md
Created July 19, 2018 03:00 — forked from gitaarik/git_submodules.md
Git Submodules basic explanation

Git Submodules basic explanation

Why submodules?

In Git you can add a submodule to a repository. This is basically a repository embedded in your main repository. This can be very useful. A couple of advantages of using submodules:

  • You can separate the code into different repositories.

TLS/Certificates cheatsheet

Save certificate being presented by any endpoint

$ echo -n | openssl s_client -connect HOSTNAME:PORT | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > server.pem
@thiyagaraj
thiyagaraj / jks-to-pem.md
Last active November 28, 2023 23:48
Convert jks/java keystore and get public and private keys as pem

Convert jks and get public and private keys out:

keytool -importkeystore -srckeystore default.keystore -destkeystore new-store.p12 -deststoretype PKCS12

  • Gives new-store.p12

openssl pkcs12 -in new-store.p12 -nokeys -out public.pem

  • Gives public key as public.pem

openssl pkcs12 -in new-store.p12 -nodes -nocerts -out private.pem

  • Gives private key as private.pem

Keybase proof

I hereby claim:

  • I am thiyagaraj on github.
  • I am thiyag (https://keybase.io/thiyag) on keybase.
  • I have a public key whose fingerprint is 7831 BBC3 EAFF 6E13 A9F5 1435 8906 04D0 CE55 B815

To claim this, I am signing this object:

@thiyagaraj
thiyagaraj / jquery.slider.custom.step.js
Created February 4, 2014 14:38
jQuery UI slider, custom step or snap points
//This should have each valid amount that can be selected in the slider
var sliderAmountMap = [10000, 20000,30000, 40000, 45000,50000,65000];
$(function() {
$( "#slider" ).slider({
value: 4, //array index of onload selected default value on slider, for example, 45000 in same array will be selected as default on load
min: 0, //the values will be from 0 to array length-1
max: sliderAmountMap.length-1, //the max length, slider will snap until this point in equal width increments
@thiyagaraj
thiyagaraj / grover.c
Created October 17, 2012 03:53
Grover - A simple autonomous arduino bot - Work in progress
#include <Servo.h>
#define HEAD_SERVO_PIN 13
#define ULTRASONIC_TRIG_PIN 2
#define ULTRASONIC_ECHO_PIN 5
#define ULTRASONIC_POWER_PIN 3
#define OBSTACLE_MIN_DISTANCE 25 //in centimeter
#define MOVE_LEFT_PIN 12 //left
#define MOVE_RIGHT_PIN 11 //right
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions">
<!-- Look and say sequence in XSLT : http://en.wikipedia.org/wiki/Look-and-say_sequence -->
<xsl:template match="/">
<xsl:variable name="start" select="string('1')"/>
START: <xsl:value-of select="$start"/>
<xsl:call-template name="loop-de-loop">
<xsl:with-param name="str" select="$start"/>
<xsl:with-param name="itr" select="number(1)"/>
<xsl:with-param name="stopAt" select="number(30)"/>
@thiyagaraj
thiyagaraj / highlight.js
Created June 5, 2012 15:36
Highlight text in a webpage based on keywords
keywords = ['hello world','goodbye cruel world'];
function replaceKeywords (domNode) {
if (domNode.nodeType === Node.ELEMENT_NODE) { // We only want to scan html elements
var children = domNode.childNodes;
for (var i=0;i<children.length;i++) {
var child = children[i];
// Filter out unwanted nodes to speed up processing.
// For example, you can ignore 'SCRIPT' nodes etc.
if (child.nodeName != 'EM') {