Skip to content

Instantly share code, notes, and snippets.

View nimatrueway's full-sized avatar
🤩

Naeim Taheri nimatrueway

🤩
View GitHub Profile
@nimatrueway
nimatrueway / notification-killer.applescript.js
Created May 14, 2025 17:55
Periodically look for a specific notification and close it in macOS
#!/usr/bin/env osascript -l JavaScript
// verify this logic using "Accessibility Inspector" of macOS if it's not working
TARGET_NOTIFICATION_TITLE_AND_BODY = ["<Set title here>", "<Set description here>"];
// generic utility functions
// -------------------------------------------------
// This function takes an element and returns a string array of all its immediate text children
function findAllTextChildren(element) {
@nimatrueway
nimatrueway / subtitle_rtl_fixer.py
Last active August 23, 2024 20:07
Fixing RTL texts before embedding in video as subtitles using ffmpeg
#!/usr/bin/env python3
import pysrt
from sys import argv
from collections import Counter
import unicodedata as ud
# Function that detects the dominant writing direction of a string
# https://stackoverflow.com/a/75739782/10327858
def dominant_strong_direction(s):
count = Counter([ud.bidirectional(c) for c in list(s)])
@nimatrueway
nimatrueway / tree.html
Last active September 23, 2023 05:55
Enhanced `dependencyBrowseTree` for SBT
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>dependencyBrowseTree</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jstree/3.2.1/jstree.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lodash.min.js"></script>
<script src="tree.data.js"></script>
@nimatrueway
nimatrueway / m4b_split.sh
Last active July 27, 2023 07:45 — forked from aularon/m4b_split.sh
Split an m4b into its chapters. No recoding is done, just splitting
#!/bin/bash
# Description: Split an m4b into its chapters. No recoding is done, just splitting
# Usage: m4b_split.sh $input_file $output_dir/
# Requires: ffmpeg, jq
# Author: Hasan Arous, Nima Taheri
# License: MIT
in="$1"
out="$2"
splits=""
@nimatrueway
nimatrueway / Main.scala
Last active June 27, 2023 05:09
Tapir Netty Graceful Shutdown Bug
import sttp.client3._
import sttp.model.Uri
import sttp.tapir._
import sttp.tapir.server.netty.{NettyFutureServer, NettyFutureServerOptions, NettyOptions}
import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.duration._
import scala.concurrent.{Await, Future, blocking}
import scala.util.{Failure, Success}
@nimatrueway
nimatrueway / index.html
Last active January 13, 2023 22:55
Simulate server timeout for large/slow file uploads after 3 seconds
<html>
<script>
async function upload() {
let files = document.getElementsByName("file")[0].files;
console.assert(files.length > 0)
const content = files[0];
const res = fetch("/upload", {
method: "PUT",
body: content,
duplex: 'half'
@nimatrueway
nimatrueway / add-instagram-video-progressbar.user.js
Created November 17, 2022 04:09
Add Instagram Video Progressbar (forked)
// ==UserScript==
// @name Add Instagram Video Progressbar
// @namespace https://greasyfork.org/en/users/85671-jcunews
// @version 1.0.4
// @license GNU AGPLv3
// @author jcunews
// @description Add a video playback progressbar at bottom of an Instagram video. This script also disables video looping. Both are configurable.
// @match *://www.instagram.com/*
// @exclude *://www.instagram.com/stories/*
// @grant none
@nimatrueway
nimatrueway / sample-script.sh
Created March 8, 2022 19:36
Sample script
#!/bin/sh
echo "Hello world!"
echo "Nima's test script is running"
@nimatrueway
nimatrueway / README.md
Last active December 2, 2024 15:58 — forked from Nua07/python_pillow_webp2gif.py
Convert webp animations to gif preserving image quality (RGB = 24bit)
@nimatrueway
nimatrueway / package.json
Last active November 23, 2021 07:18
Little tool to fix overlapping subtitles (especially the ones extracted from english auto-subtitles of youtube, vtt files that you would convert to srt with ffmpeg)
{
"name": "nima-scripts",
"version": "1.0.0",
"@comment dependencies": [
"// argparse: powerful argument parser",
"// https://github.com/nodeca/argparse",
"// subtitle: subtitle parser",
"// https://github.com/gsantiago/subtitle.js"
],
"dependencies": {