Skip to content

Instantly share code, notes, and snippets.

View hrishikeshrt's full-sized avatar
🇮🇳

Hrishikesh Terdalkar hrishikeshrt

🇮🇳
View GitHub Profile
@hrishikeshrt
hrishikeshrt / shabdle++.user.js
Last active December 16, 2022 11:49
Shabdle++: Upgrade your Shabdle (https://kach.github.io/shabdle/) with past puzzles, custom puzzles, random puzzles and static links!
// ==UserScript==
// @name Shabdle++
// @namespace http:/gist.github.com/hrishikeshrt/
// @version 0.3
// @description Upgrade your Shabdle with past puzzles, custom puzzles, random puzzles and static links!
// @author You
// @match https://kach.github.io/shabdle/*
// @require https://code.jquery.com/jquery-3.6.0.min.js
// @downloadURL https://gist.githubusercontent.com/hrishikeshrt/694cfb91903068eb581c6fe220f382bf/raw/shabdle++.user.js
// @updateURL https://gist.githubusercontent.com/hrishikeshrt/694cfb91903068eb581c6fe220f382bf/raw/shabdle++.user.js
@hrishikeshrt
hrishikeshrt / reverseproxied.py
Created December 11, 2022 13:32
ReverseProxied Middleware for Flask
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Sep 10 13:56:54 2019
@author: Hrishikesh Terdalkar
# Solution for Different Mountpoint of Flask App
# https://github.com/alex-leonhardt/flask-blog/blob/master/reverseproxied.py
# https://gist.github.com/flengyel/1444972/f8338b7fa63475a23abf63c9a3fc68184791e8d2
@hrishikeshrt
hrishikeshrt / model_to_dict.py
Last active December 18, 2023 22:42
model_to_dict function for SQLAlchemy
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
model_to_dict() functiion for SQLAlchemy models
Based on answers by "doog abides" and "daveoncode" from
https://stackoverflow.com/questions/23554119/convert-sqlalchemy-orm-result-to-dict
@author: Hrishikesh Terdalkar
"""

Conventinal Commit Messages

See how a minor change to your commit message style can make a difference. Examples

Have a look at CLI util git-conventional-commits to ensure this conventions and generate changelogs

Commit Formats

Default

@hrishikeshrt
hrishikeshrt / authenticator.md
Last active January 29, 2023 17:44
Firewall Authenticator

Firewall Authenticator

Improved version of the firewall authentication script.

  • Structured
  • Python3 Compatible
  • Importable FirewallAuthenticator class that simulates the finite state machine

Usage

@hrishikeshrt
hrishikeshrt / crop_video.py
Created August 18, 2021 06:41
Crop Video using ffmpeg
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Crop Video in multiple places using ffmpeg
* Input file: a text file containing several lines.
Each line should contain `start_time` and `end_time` of the interval (hh:mm:ss.ms)
e.g.
00:00:05.0 00:00:27.18
00:02:07.18 00:03:14.1
@hrishikeshrt
hrishikeshrt / Transliteration_CLI.md
Last active February 9, 2022 20:05
Transliteration CLI

Transliteration CLIs

Place all files in a folder. Make the shell.py and cli.py executable.

Run cli.py --help to see available options. Run shell.py from command line for REPL.

Example of REPL

@hrishikeshrt
hrishikeshrt / README.md
Last active June 9, 2021 18:52
Python User Snippet for VSCode

Instructions

  • Location: File > Preferences > User Snippets > python.json
  • Location on disk: ~/.config/Code/User/snippets/
  • Copy Line 15 to 30 and paste in python.json if it exists, else create and copy entire contents.
@hrishikeshrt
hrishikeshrt / README.md
Last active November 17, 2023 17:27
cgroups - Limit memory usage of firefox

Limit Memory Usage using cgroups

Example: firefox

Limiting memory per process with cgroups

cgroups (abbreviated from control groups) is a Linux kernel feature that limits, accounts for, and isolates the resource usage (CPU, memory, disk I/O, network, etc.) of a collection of processes. You can use it to make sure specific processes and their children cannot allocate more than a given amount of RAM.

On Ubuntu you must install the following package:

@hrishikeshrt
hrishikeshrt / indic-stardict-downloader
Created April 24, 2021 16:52
Download stardict dictionaries from indic-dict
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Apr 24 19:25:34 2021
@author: Hrishikesh Terdalkar
Original: https://github.com/sanskrit-coders/pydictupdater
"""