Skip to content

Instantly share code, notes, and snippets.

View surajsharma's full-sized avatar
⚕️
turning pro

Suraj Sharma surajsharma

⚕️
turning pro
View GitHub Profile
#!/bin/bash
LAST_HASH=""
# Detect clipboard tool
if command -v wl-paste &> /dev/null; then
CLIP_COPY="wl-copy"
CLIP_PASTE="wl-paste"
elif command -v xsel &> /dev/null; then
CLIP_COPY="xsel --clipboard --input"
#!/bin/bash
# Convert WSL path to Windows path
if [ "$1" = "." ]; then
WINPATH=$(wslpath -w $(pwd))
elif [ -n "$1" ]; then
WINPATH=$(wslpath -w "$1")
else
WINPATH=""
fi
@surajsharma
surajsharma / hammerspoon-init.lua
Created August 14, 2025 10:19
hammerspoon init
local hyper = {"alt", "cmd"}
local BITLY_API_ACCESS_TOKEN = ""
-- Load Spoons
hs.loadSpoon("MiroWindowsManager")
hs.loadSpoon("ReloadConfiguration")
--hs.loadSpoon("BingDaily")
hs.loadSpoon("Caffeine")
spoon.ReloadConfiguration:start()
@surajsharma
surajsharma / import_db.py
Created August 14, 2025 10:19
import a bunch of stuff into a new db
"""Script to import any number of JSON formatted files into a db"""
import sqlite3
import requests
from tqdm import tqdm
from sqlite3 import Error
from operator import itemgetter
from collections import defaultdict
files = [
@surajsharma
surajsharma / mkgif.sh
Created August 14, 2025 10:17
ffmpeg gif creator
#!/bin/bash
set -e
PROG=${0##*/}
pushd "$(dirname "$0")/.." >/dev/null
popd >/dev/null
_err() { echo "$PROG: $@" >&2; exit 1; }
FPS=50
MAXSIZE=800
@surajsharma
surajsharma / lmarena.js
Created April 9, 2025 13:11
better lmarena.ai
// ==UserScript==
// @name lmarena.ai Custom Tweaks (Wait for Height 0)
// @namespace http://tampermonkey.net/
// @version 1.5
// @description Suppress alert, hide element, and click Arena tab when model_selector_md height is zero
// @match https://lmarena.ai/*
// @grant none
// ==/UserScript==
(function () {
@surajsharma
surajsharma / install.sh
Last active March 22, 2025 10:46
setup code-server
#!/bin/bash
# Function to check if a command exists
command_exists() {
command -v "$1" >/dev/null 2>&1
}
# Set Git user name and email credentials
git config --global user.name "suraj sharma"
@surajsharma
surajsharma / font.sh
Created March 19, 2025 21:36
download and install font on linux
#!/bin/bash
# Define the font URL from Overleaf (direct link to the font file)
FONT_URL="https://filebin.net/xp47sk0a8rew8uel/bm.ttf"
# Define the font name (change this if you know the exact font file name)
FONT_NAME="custom_font.ttf"
# Define the installation directory
FONT_DIR="/usr/share/fonts/truetype/bm"
@surajsharma
surajsharma / postgres_with_adminer_codespaces.yml
Created March 19, 2025 21:33
run postgres with adminer on codespaces
version: "3.8"
services:
postgres:
image: postgres:13-alpine
environment:
POSTGRES_DB: campaigns
POSTGRES_USER: admin
POSTGRES_PASSWORD: admin
ports:
@surajsharma
surajsharma / hotkeys.ahk
Created August 18, 2024 04:30
hotkeys ahk2 win11
#Requires AutoHotkey v2.0
#SingleInstance force
ScriptStartModTime := FileGetTime(A_ScriptFullPath)
SetTimer(CheckScriptUpdate, 100, -1) ; 100 ms, highest priority
; Hotkeys for different window types
^Space::ToggleSpecificWindow("terminal")
^!Space::ToggleSpecificWindow("browser")
+Space::ToggleSpecificWindow("notepad++")