Skip to content

Instantly share code, notes, and snippets.

View saravanabalagi's full-sized avatar

Saravanabalagi Ramachandran saravanabalagi

  • Ireland
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Battery_state</key>
<false/>
<key>CPU_barChart_position</key>
<integer>0</integer>
<key>CPU_bar_chart_box</key>
<true/>
@saravanabalagi
saravanabalagi / us_to_uk_check.md
Created December 2, 2024 17:23
Regex for US to UK english to replace "iz" with "is"

Regex for US to UK english

To replace "iz" with "is" in LATEX documents:

  • find
(?<!\\(?:cite|href|url)\{[^}]*)(\b(?!size\b|sizes\b|sized\b|downsize\b|footnotesize\b|BSize\b|resized\b|quantize\b|quantization\b|horizontally\b|itemize\b|scriptsize\b|resize\b|horizontal\b|Webviz\b|OdoViz\b)\w*)iz(\w*\b)
  • replace
@saravanabalagi
saravanabalagi / find_duplicates_in_bib.py
Created December 2, 2024 17:15
Find duplicates in bibtex file based on publication title
import bibtexparser
from collections import defaultdict
# Replace 'yourfile.bib' with the path to your BibTeX file
bibtex_filename = 'root.bib'
# Load the BibTeX file
with open(bibtex_filename, encoding='utf-8') as bibtex_file:
bib_database = bibtexparser.load(bibtex_file)
@saravanabalagi
saravanabalagi / arrow_keys_shortcuts.ahk
Created August 5, 2024 08:18
AutoHotkey Config for Arrow keys
SC110::Send, {Home}
SC119::Send, {End}
SC124::Send, {PgUp}
SC122::Send, {PgDn}
+SC110::Send, +{Home}
+SC119::Send, +{End}
+SC124::Send, +{PgUp}
+SC122::Send, +{PgDn}
@saravanabalagi
saravanabalagi / Add_GLU_torch_pruning.md
Last active April 10, 2024 22:29
Add GLU to Torch Pruning lib WIP

In dependency.py, add a new update fn in DependencyGraph

    def _update_glu_index_mapping(self, glu_node: Node):
        if glu_node.type != ops.OPTYPE.GLU:
            return

        # GLU halves the number of channels by applying sigmoid
        input_node = glu_node.inputs[0]
        in_channels = self.get_out_channels(input_node)
@saravanabalagi
saravanabalagi / .pre-commit-config.yaml
Last active March 6, 2024 16:45
Ruff all rules with description
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.2
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.8.0
hooks:
@saravanabalagi
saravanabalagi / img_combine_h.py
Created December 11, 2023 13:55
Combines images horizontally using imagemagick in the specified directory based on filename suffixes: img_01.jpg, img_02.jpg, img_03.jpg will be combined into img.jpg
from pathlib import Path
import subprocess
import argparse
def find_and_append_images_with_pathlib(directory):
"""
Adjusted script using pathlib to find images in the specified directory with a given pattern
and append them horizontally using the 'convert' command from ImageMagick.
It supports both .jpg and .png files and handles different suffix patterns.
@saravanabalagi
saravanabalagi / segment_trim_60_sec.sh
Created December 5, 2023 21:24
YouTube Trim into 60 second clips for Shorts
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: $0 <input_video> [output_directory]"
exit 1
fi
input_video="$1"
output_directory="${2:-segmented}" # Use "segmented" as the default if no second argument is provided
This is a sample text file
@saravanabalagi
saravanabalagi / place_types.json
Created November 11, 2022 17:30
MACMORRIS Places of Literary Importance
[{"id":1,"name":"Province","created_at":"2022-03-28T14:09:46.016Z","updated_at":"2022-03-28T14:09:46.016Z"},{"id":2,"name":"County","created_at":"2022-03-28T14:09:46.032Z","updated_at":"2022-03-28T14:09:46.032Z"},{"id":3,"name":"City","created_at":"2022-03-28T14:09:46.047Z","updated_at":"2022-03-28T14:09:46.047Z"},{"id":4,"name":"Town","created_at":"2022-03-28T14:09:46.060Z","updated_at":"2022-03-28T14:09:46.060Z"},{"id":5,"name":"Townland","created_at":"2022-03-28T14:09:46.069Z","updated_at":"2022-03-28T14:09:46.069Z"},{"id":6,"name":"Barony","created_at":"2022-03-28T14:09:46.077Z","updated_at":"2022-03-28T14:09:46.077Z"},{"id":7,"name":"Street ","created_at":"2022-03-28T14:09:46.085Z","updated_at":"2022-03-28T14:09:46.085Z"},{"id":8,"name":"Village","created_at":"2022-03-28T14:09:46.094Z","updated_at":"2022-03-28T14:09:46.094Z"},{"id":9,"name":"River ","created_at":"2022-03-28T14:09:46.102Z","updated_at":"2022-03-28T14:09:46.102Z"},{"id":10,"name":"Other","created_at":"2022-03-28T14:09:46.109Z","updated_at"