Skip to content

Instantly share code, notes, and snippets.

View saravanabalagi's full-sized avatar

Saravanabalagi Ramachandran saravanabalagi

  • Ireland
View GitHub Profile
@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"
@saravanabalagi
saravanabalagi / Dockerfile
Last active September 13, 2022 13:39
New Rails App using Docker
FROM ruby:3.1
RUN apt update -qq && apt install -y nodejs postgresql-client
RUN gem install rails -v '7.0.3.1'
ARG APP=/railsapp
WORKDIR ${APP}
ADD Gemfile ${APP}/
RUN bundle install
@saravanabalagi
saravanabalagi / scene_categorization_dataset_links.md
Last active August 5, 2022 20:55
Links to Scene Categorization Dataset
@saravanabalagi
saravanabalagi / inotify-limits.sh
Created June 1, 2022 12:25
Get the procs sorted by the number of inotify watchers
#!/bin/sh
# Get the procs sorted by the number of inotify watchers
# @author Carl-Erik Kopseng
# @latest https://github.com/fatso83/dotfiles/blob/master/utils/scripts/inotify-consumers
# Discussion leading up to answer: https://unix.stackexchange.com/questions/15509/whos-consuming-my-inotify-resources
usage(){
cat << EOF
Usage: $0 [--help|--limits]
@saravanabalagi
saravanabalagi / install_python.md
Last active April 27, 2022 15:24
Download and Install Python without sudo privileges

Install Python

Builds python from source and installs to ~/.local/share/python/python-version without requiring sudo privileges.

Quick Start

Specify python version when calling the script and it will download, build and install the specified python version from python.org

sh ./install_python.sh 3.8.1