Skip to content

Instantly share code, notes, and snippets.

View hemanth22's full-sized avatar

Hemanth B hemanth22

View GitHub Profile
@hemanth22
hemanth22 / convert-p12-pem-formats.bash
Created November 29, 2023 08:25 — forked from Integralist/convert-p12-pem-formats.bash
Convert a P12 into a PEM and vice versa
# Convert p12 to pem
openssl pkcs12 -in certificate.p12 -out certificate.pem -clcerts -nodes
# Convert pem to p12
openssl pkcs12 -export -in certificate.pem -out certificate.p12 -passout pass:password
@hemanth22
hemanth22 / convert-deploymentconfig-to-deployment.md
Created November 29, 2023 08:24 — forked from bmaupin/convert-deploymentconfig-to-deployment.md
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@hemanth22
hemanth22 / deployment.yml
Created November 12, 2023 15:17 — forked from troyharvey/deployment.yml
Using Kubernetes envFrom for environment variables
# Use envFrom to load Secrets and ConfigMaps into environment variables
apiVersion: apps/v1beta2
kind: Deployment
metadata:
name: mans-not-hot
labels:
app: mans-not-hot
spec:
replicas: 1
@hemanth22
hemanth22 / python_ssh_jsch.py
Created June 16, 2023 15:43 — forked from huskercane/python_ssh_jsch.py
SSH from jython using jsch
I have to make ssh calls from python, there are few options
however we run in jython and it runs automated, so adding extension is difficult.
luckily we have access to jsch jars.
here is a example on how to connect to a ssh server using jsch from python/jython
from com.jcraft.jsch import JSch
@hemanth22
hemanth22 / README.md
Created May 14, 2023 09:52 — forked from MichaelCurrin/README.md
GitHub GraphQL - Get files in a repository

Get GitHub Files

Get the metadata and content of all files in a given GitHub repo using the GraphQL API

You might want to get a tree summary of files in a repo without downloading the repo, or maybe you want to lookup the contents of a file again without download the whole repo.

The approach here is to query data from GitHub using the Github V4 GraphQL API.

About the query

@hemanth22
hemanth22 / README.md
Created April 24, 2023 16:18 — forked from gbraad/README.md
Minishift hostfolders

Minishift

Starting Minishift

In the previous version, when you didn't install the driver plugin, Minishift would fail with an issue.

$ minishift start
@hemanth22
hemanth22 / vaultsealmanager.sh
Created April 23, 2023 17:42 — forked from ccampanale/vaultsealmanager.sh
Bash shell script to check seal status for local vault server and attempt to unseal using keys secured in vault secret store. Supports HA Vault clusters with TLS with unseal keys stored as secrets in vault (see code). Relies on registered service vault.service.consul, in place DNS configuration, and a single unsealed vault instance in your clust…
#!/bin/bash
export vault=/usr/local/bin/vault
export VAULT_TOKEN=$(cat /root/.vault-token)
vault_cacert='-ca-cert=/path/to/your/ca.pem'
local_vault="-address=https://$(hostname -f):8200"
unsealed_vault="-address=https://$(getent hosts $(dig +short vault.service.consul | tail -n 1) | awk '{ print $2 }'):8200"
leader_vault="-address=https://$($vault status $vault_cacert $unsealed_vault 2> /dev/null | grep Leader | awk '{ print $2 }' | sed 's/^http\(\|s\):\/\///g'):8200"
vault_read="$vault read $vault_cacert $leader_vault"
vault_unseal="$vault unseal $vault_cacert $local_vault"
package main
import "fmt"
func main () {
for i:=1; i<=100; i++ {
if i % 15 == 0 {
fmt.Println("FizzBuzz")
} else if i % 3 == 0 {
@hemanth22
hemanth22 / slack_webhook_post.py
Created February 11, 2023 16:05 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
@hemanth22
hemanth22 / default.j2
Created February 5, 2023 17:42 — forked from perfecto25/default.j2
Python function to send email using a Jinja HTML template
<style type="text/css">
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 300;
src: local('Open Sans Light'), local('OpenSans-Light'), url(http://fonts.gstatic.com/s/opensans/v13/DXI1ORHCpsQm3Vp6mXoaTa-j2U0lmluP9RWlSytm3ho.woff2) format('woff2');
unicode-range: U+0460-052F, U+20B4, U+2DE0-2DFF, U+A640-A69F;
}
.body {
width: 90%;