Skip to content

Instantly share code, notes, and snippets.

View iamshreeram's full-sized avatar

Shreeram iamshreeram

  • 127.0.0.1
View GitHub Profile
@iamshreeram
iamshreeram / main.go
Created April 28, 2025 00:40
plain tcp proxy for db
package main
import (
"io"
"log"
"net"
"sync"
"github.com/denisenkom/go-mssqldb/msdsn"
)
@iamshreeram
iamshreeram / mssql_proxy_tds.py
Created April 26, 2025 12:22
create db proxy for mssql server
##################
'''
This script creates a proxy for mssql server.
1. You can start the mssql server using below docker commands -
docker pull mcr.microsoft.com/azure-sql-edge
docker run -e "ACCEPT_EULA=1" -e "MSSQL_SA_PASSWORD=password" -e "MSSQL_PID=Developer" -e "MSSQL_USER=sa" -p 1433:1433 -d --name=sql mcr.microsoft.com/azure-sql-edge
2. In new terminal, just copy below script and run it as `python mssql_proxy_tds.py`
@iamshreeram
iamshreeram / ollama-help-commands.md
Last active July 2, 2024 17:19
Commands and Scripts that help in the operations of ollama

View all installed Ollama models using command line

for i in $(ollama list); do name=`echo "$i" | grep ":"`; [[ ${name} != *":"* ]] || echo -e "\033[0;31m\033[1m$name\033[0m\033[0m\n`ollama show $name`" ; done

Upgrade all installed Ollama models using command line

ollama list | tail -n +2 | awk '{print $1}' | xargs -I {} ollama pull {}
@iamshreeram
iamshreeram / setting-ebpf-in-mac.md
Last active April 28, 2024 19:24
setting up ebpf in mac-intel
  1. Get the vagrant working with virtual box
  2. Bring up the below vagrant file
$script = <<-SCRIPT
  echo "Provisioning..."
  sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
  echo "deb https://repo.iovisor.org/apt/$(lsb_release -cs) $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/iovisor.list
  sudo apt-get update
  sudo apt-get -y install bcc-tools libbcc-examples linux-headers-$(uname -r)
SCRIPT
@iamshreeram
iamshreeram / setting-wasm-in-mac.md
Last active April 28, 2024 03:33
setting wasm/wasi in mac and running it on wasm runtime
@iamshreeram
iamshreeram / readgmail.py
Created February 28, 2024 09:35
read-email from gmail
import imaplib
import email
# Gmail IMAP server details
IMAP_SERVER = "imap.gmail.com"
IMAP_PORT = 993
# Gmail account credentials
EMAIL = "[email protected]"
PASSWORD = "your_password"
@iamshreeram
iamshreeram / usernamechecker.py
Last active February 27, 2024 20:23
checking github username availability
from logging import Logger
import requests
import time
import datetime
import random
from multiprocessing import Process, Lock
# proxy server details comes from
# https://github.com/themiralay/Proxy-List-World
# https://github.com/vakhov/fresh-proxy-list
@iamshreeram
iamshreeram / pointers-on-struct.md
Last active March 29, 2021 14:12
Gqlgen generates structs with pointer

What happened?

When I mark a field in graphql schema as non-mandatory, the struct generated model contains pointers instead of actual variable.

Graphql Schema Generated Struct
input NewTodo {
text: String
userId: String
}
type NewTodo struct {
Text *string json:"text"
UserID *string json:"userId"
}

When the field is marked as mandatory,

| Graphql Schema | Generated Struct |

@iamshreeram
iamshreeram / udp-spoof.py
Created October 23, 2020 07:40
Simple python code to spoof udp source and destination
from scapy.all import *
import time
ip = IP(dst='127.0.0.127', src='10.99.99.99')
udp = UDP(sport=321,dport=123)
payload = '\x01\x0f'
packet = ip/udp/payload
send(packet)
while(True):
@iamshreeram
iamshreeram / file-backup-copier.sh
Created October 23, 2020 07:39
Live monitor for any new file creation and copy them to destn location : Used for write-only back-up for new files
srcdir="/tmp"; inotifywait -e close_write --format "%f" --monitor $srcdir |
while IFS= read -r line
do
echo $line
cp "$srcdir/$line" . #this would not replicate directories
# tar cf - "$line" | tar -C destination/ xf - #this should replicate directories
done