Skip to content

Instantly share code, notes, and snippets.

View tsureshkumar's full-sized avatar
💭
I may be slow to respond.

Sureshkumar Thangavel tsureshkumar

💭
I may be slow to respond.
View GitHub Profile
@tsureshkumar
tsureshkumar / Bazel Test.md
Last active November 25, 2022 10:32
See logs in bazel
  • check logging library is setup
    • check logback/slf4j implementation library is added in your dependencies in bazel
  • check you have the logback-test.xml in path src/test/resources/
  • you run the bazel test target --test_output=ALL
@tsureshkumar
tsureshkumar / renew.py
Created February 24, 2020 07:33
Renew a certificate with same details
from cryptography.fernet import Fernet
from cryptography import x509
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.serialization import load_pem_public_key, load_pem_private_key
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
import datetime
import argparse
@tsureshkumar
tsureshkumar / README.md
Last active November 30, 2019 19:07
Building minimal kernel (i386) on Mac

References

https://wiki.osdev.org/Bare_Bones

Commands followed

$ brew installgcc i386-elf-gcc i386-elf-grub gmp mpfr libmpc autoconf automake xorriso mtools qemu

and all commands from above link except that instead of i686 use i386.

@tsureshkumar
tsureshkumar / README.md
Last active May 2, 2019 11:44
Fix for VirtualBox/Kubernetes to resolve dns while on VPN

Making outside connections from guest when VPN is running on host

The problem was that after Cisco VPN was connected, guest could not be resolving the DNS as VPN changes the dns servers. Guest was still hitting the old dns configured and VPN was not allowing them.

The solution of setting VirtualBox to use host resolver neither VBoxManage modifyvm "kubespray_k8s-1_1549866615143_75146" --natdnshostresolver1 on nor VBoxManage modifyvm xxx --dnsproxy1 no worked. Also, do not set both, VirtualBox drops one of them and you can check them in VM logs.

The solution is to install dnsmasq on host brew install dnsmasq and then set the VBoxManage modifyvm xxx --dnsproxy1 on. Then the guest vms could connect to internet.

@tsureshkumar
tsureshkumar / jwe.sc
Created November 16, 2018 08:19
JWE encryption/decryption sample
/*
to generate keypairs for this
# generate a certificate keypair
openssl req -x509 -newkey rsa:2048 -keyout /tmp/key.pem -out /tmp/cert.pem -days 365
# strip passphrase out
openssl rsa -in /tmp/key.pem -out /tmp/key2.pem
# convert to pkcs8
openssl pkcs8 -topk8 -inform pem -outform pem -in /tmp/key2.pem -out /tmp/key3.pem -nocrypt
*/
@tsureshkumar
tsureshkumar / base.yml
Last active October 8, 2018 05:30
Kafka Splunk Docker swarm files
---
version: '3.5'
networks:
kafkanet:
attachable: true
@tsureshkumar
tsureshkumar / jwt.coffee
Created December 23, 2015 04:13
Command line script to validate jwt tokens
# you need to have following nps
# jsonwebtoken, rxjs, rx-node
# usage: echo -n "Xds32..." | coffee jwt.coffee
jwt = require('jsonwebtoken')
rx = require('rx')
rxn = require('rx-node')
rxn.fromStream(process.stdin).buffer(() => rx.Observable.timer(125))
.subscribe((x) =>