Skip to content

Instantly share code, notes, and snippets.

View tamalsaha's full-sized avatar
🎢
Building. Learning. Improving.

Tamal Saha tamalsaha

🎢
Building. Learning. Improving.
View GitHub Profile
@sub-mod
sub-mod / crc_remote_laptop.md
Last active July 9, 2022 12:03
Setup CodeReady Containers on Remote Server and connect from Laptop 4.2

Following steps work for F29 for F31 look here

On the remote host

cat /etc/redhat-release
Fedora release 29 (Twenty Nine)

Install packages

@tamalsaha
tamalsaha / git-split.sh
Last active May 25, 2019 22:35
Splitting a subfolder out into a new repository without changing project root directory
# If you want to change project root, follow
# https://help.github.com/en/articles/splitting-a-subfolder-out-into-a-new-repository
# More advanced stuff: https://manishearth.github.io/blog/2017/03/05/understanding-git-filter-branch/
# ---------------------------------------------------------------------------------------------------
## STEPS for Splitting a subfolder out into a new repository without changing project root directory
# clone the repo
@liangrog
liangrog / k8s-code-gen-tags
Last active September 11, 2023 04:51
kubernetes code generator tags
// +genclient - generate default client verb functions (create, update, delete, get, list, update, patch, watch and depending on the existence of .Status field in the type the client is generated for also updateStatus).
// +genclient:nonNamespaced - all verb functions are generated without namespace.
// +genclient:onlyVerbs=create,get - only listed verb functions will be generated.
// +genclient:skipVerbs=watch - all default client verb functions will be generated except watch verb.
// +genclient:noStatus - skip generation of updateStatus verb even thought the .Status field exists.
@tamalsaha
tamalsaha / 01_pkcs12-cacerts-workaround.sh
Created June 22, 2018 08:19 — forked from mikaelhg/01_pkcs12-cacerts-workaround.sh
Workaround for java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
# Ubuntu 18.04 and various Docker images such as openjdk:9-jdk throw exceptions when
# Java applications use SSL and HTTPS, because Java 9 changed a file format, if you
# create that file from scratch, like Debian / Ubuntu do.
#
# Before applying, run your application with the Java command line parameter
# java -Djavax.net.ssl.trustStorePassword=changeit ...
# to verify that this workaround is relevant to your particular issue.
#
# The parameter by itself can be used as a workaround, as well.
@alexanderdavidsen
alexanderdavidsen / guard.json
Created April 5, 2018 10:44
Sample Grafana dashboard for Guard using prometheus as a data source
{
"__inputs": [
{
"name": "DS_PROMETHEUS",
"label": "prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
}
@lefred
lefred / addition_to_sys.sql
Last active May 24, 2023 12:28
MySQL Group Replication extra functions and views to sys schema
USE sys;
DELIMITER $$
CREATE FUNCTION IFZERO(a INT, b INT)
RETURNS INT
DETERMINISTIC
RETURN IF(a = 0, b, a)$$
CREATE FUNCTION LOCATE2(needle TEXT(10000), haystack TEXT(10000), offset INT)
@tamalsaha
tamalsaha / ksh
Last active September 21, 2017 05:56
Kubectl exec with working terminal
#!/bin/sh
if [ "$1" = "" ]; then
echo "Usage: ksh <pod> [flags_to_kubectl]"
exit 1
fi
POD=$1
shift
COLUMNS=`tput cols`
@peterhellberg
peterhellberg / graceful.go
Last active August 20, 2023 08:49
*http.Server in Go 1.8 supports graceful shutdown. This is a small example.
package main
import (
"context"
"log"
"net/http"
"os"
"os/signal"
"time"
)
@tamalsaha
tamalsaha / check_module.py
Created December 21, 2016 01:57
Check if a python module is installed
# http://stackoverflow.com/a/14050282
def check_antipackage():
from sys import version_info
sys_version = version_info[:2]
found = True
if sys_version < (3, 0):
# 'python 2'
from pkgutil import find_loader
found = find_loader('antipackage') is not None
elif sys_version <= (3, 3):
@r0l1
r0l1 / copy.go
Last active March 23, 2024 12:38
Copy a directory tree (preserving permissions) in Go.
/* MIT License
*
* Copyright (c) 2017 Roland Singer [roland.singer@desertbit.com]
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions: