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
@tamalsaha
tamalsaha / tc mirroring.md
Created September 6, 2022 07:57 — forked from mcastelino/tc mirroring.md
Using tc redirect to connect a virtual machine to a container network

Connecting a veth device to tap

  • veth device from CNI/CNM plugin: eth0
  • tap device that connects to the VM: tap0

Redirecting traffic between the two devices

tc qdisc add dev eth0 ingress
tc filter add dev eth0 parent ffff: protocol all u32 match u8 0 0 action mirred egress redirect dev tap0
@tamalsaha
tamalsaha / bigetc.go
Created May 12, 2022 06:08 — forked from c4pt0r/bigetc.go
bigetc.go
package bigetc
import (
"database/sql"
"time"
"github.com/c4pt0r/log"
_ "github.com/go-sql-driver/mysql"
)
@tamalsaha
tamalsaha / k8s-code-gen-tags
Created March 21, 2022 10:28 — forked from liangrog/k8s-code-gen-tags
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 / crc.sh
Last active September 20, 2021 15:51 — forked from sub-mod/crc_remote_laptop.md
Setup CodeReady Containers on Remote Server and connect from Laptop 4.2
dns upgrade
# https://centos.pkgs.org/7/epel-x86_64/tinyproxy-1.8.3-2.el7.x86_64.rpm.html
curl -O https://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/t/tinyproxy-1.8.3-2.el7.x86_64.rpm
yum --nogpgcheck localinstall tinyproxy-1.8.3-2.el7.x86_64.rpm
dnf install ncurses
@tamalsaha
tamalsaha / URL Parsing
Created June 19, 2020 02:12 — forked from joshisa/URL Parsing
Parsing of URLs using bash sh scripting
#!/bin/bash
# Referenced and tweaked from http://stackoverflow.com/questions/6174220/parse-url-in-shell-script#6174447
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol
url="$(echo ${1/$proto/})"
# extract the user (if any)
userpass="$(echo $url | grep @ | cut -d@ -f1)"
pass="$(echo $userpass | grep : | cut -d: -f2)"
if [ -n "$pass" ]; then
@tamalsaha
tamalsaha / check_git_branch_exists.sh
Created June 11, 2020 01:07 — forked from iridiumcao/check_git_branch_exists.sh
How to check if a git branch exists in the local/remote repository?
# Local:
# https://stackoverflow.com/questions/21151178/shell-script-to-check-if-specified-git-branch-exists
# test if the branch is in the local repository.
# return 1 if the branch exists in the local, or 0 if not.
function is_in_local() {
local branch=${1}
local existed_in_local=$(git branch --list ${branch})
if [[ -z ${existed_in_local} ]]; then
echo 0
@tamalsaha
tamalsaha / addition_to_sys.sql
Created December 10, 2019 04:19 — forked from lefred/addition_to_sys.sql
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 / papers.md
Created July 30, 2018 08:12 — forked from jhertz/papers.md
Security Papers I Like

In absolutely no order

@tamalsaha
tamalsaha / jessfraz.md
Created July 30, 2018 08:11 — forked from acolyer/jessfraz.md
Containers, operating systems and other fun things from The Morning Paper

In a terminal start a server.

$ python -m SimpleHTTPServer 8000

In another terminal set up the cgroups freezer.