Skip to content

Instantly share code, notes, and snippets.

View mohsin's full-sized avatar

Saifur Rahman Mohsin mohsin

View GitHub Profile
@mohsin
mohsin / rebuild_idb_files.sh
Created October 1, 2024 09:03
Script that recovered the IDB files back into mySQL
#!/bin/bash
# Variables
DB_NAME="my_db" # Replace with your database name
IBD_FOLDER="/opt/homebrew/var/mysql_backup/my_db" # Folder containing all the backed up .ibd files
MYSQL_USER="root" # MySQL username
MYSQL_PASSWORD="password" # MySQL password
MYSQL_CMD="mysql -u$MYSQL_USER -p$MYSQL_PASSWORD $DB_NAME"
# Variables for system paths and user information
@mohsin
mohsin / main.py.zsh
Created December 3, 2022 12:34
Threshold Analysis One-Line
i=1;for file in *.mp4; do if [ $((i % 10)) -eq 0 ]; then i=$[i + 1]; sleep 1000 && python3 /Users/Mohsin/Desktop/Dt/test/main.py "$file" >> out.txt &; else i=$[i + 1]; python3 /Users/Mohsin/Desktop/Dt/test/main.py "$file" >> out.txt &; fi; done;
@mohsin
mohsin / collapse-loader.js
Created September 23, 2022 11:23
To import Bootstrap v5 collapse.js alone
../../node_modules/bootstrap/js/dist/dom/event-handler.js
../../node_modules/bootstrap/js/dist/dom/data.js
../../node_modules/bootstrap/js/dist/util/config.js
../../node_modules/bootstrap/js/dist/base-component.js
../../node_modules/bootstrap/js/dist/util/index.js
../../node_modules/bootstrap/js/dist/collapse.js
@mohsin
mohsin / chords-recognition-install.md
Created March 14, 2022 20:02
Installing Chords Recognition on M1 Silicon MacBook Pro

I was trying to install Chords Recognition and faced a series of errors but was finally able to get it to work. Wrote some bullet points to re-create incase I have to do it all over again, so putting that up here as a gist.

Final command to see it in action:

python3 realtime.py --category MirexRoot
OR
python3 realtime.py --category MirexMajMin

First clone and setup python environment:

@mohsin
mohsin / blr-zones.txt
Created January 2, 2022 17:41
Bangalore Zones
Zone - Yelahanka
1 - Kempegowda Ward
2 - Chowdeshwari Ward
3 - Attur
4 - Yelahanka Satellite town
5 - Jakkur
6 - Thanisandra
7 - Byatarayanapura
8 - Kodigehalli
9 - Vidyaranyapura
@mohsin
mohsin / macox-dota-shortcut-issue.md
Last active February 6, 2021 19:36
Fixing Dota 2 desktop icon shortcut issue

I installed Dota on my new M1 chipped Mac and came across the same issue. Fortunately, I'm a developer so I figured out what's going on. Simply right-click on the shortcut and open the Contents/MacOS folder. There should be a file that you can open using a text editor.

Replace that with this:

#!/bin/zsh
/Applications/Steam.app/Contents/MacOS/steam_osx steam://run/570

Now close that. What this tells it is that open the steam app in the Applications folder and then run dota. Next, you have to add an Info.plist in the base directory i.e. the directory which contains MacOS and Resource folder. Create a file with that name or copy-paste the one from the Steam app by doing the same right-click Show Package Contents. Now you have to merely edit the values (preferably using XCode coz it's easier) otherwise, just open a text editor and edit it (hint--the key is followed by the value). So simply set the following keys:

@mohsin
mohsin / postman-word-search.php
Created February 3, 2021 06:41
Postman Galaxy Event Quiz PHP script for solving the word search puzzle
<?php
// Use php 8.0 for str_contains
$arrays = [
'vvtazcszriaudu',
'aoejmmwtfwteoo',
'responsertyanr',
'iytycuyabrfxtx',
'avwlkcmmonitor',
'bijbsufmeqkwtp',
@mohsin
mohsin / duplicate-lang-str.php
Created October 13, 2020 20:12
Find duplicate strings in Laravel resource lang folders
<?php
/*
* This program takes in a Laravel Resource folder strings and finds the frequency of the strings i.e. repeatation.
* Usage: php duplicate-lang-str.php ~/Desktop/resources/lang/en/
*/
if (!isset($argv[1])) {
die(sprintf("\e[37;41mFolder path unspecified\e[39;49m\nCommand usage: php %s <folder-path>", $argv[0]));
}
@mohsin
mohsin / build.md
Last active November 4, 2020 19:47
Fetch iOS development team ID to run cordova ionic builds from the command line

To run builds in Cordova Ionic without having to generate the project and opening it in XCode and selecting it from command line:

  1. First run:
security find-identity -p codesigning -v

Command will return list of certificates such as: 13D6BF214D52A777C59114591DBBA36D875538F7 "Apple Development: [email protected] (2PZG12NNCV)"

  1. Fetch the correct required ID, by pasting in the selected certificate name as shown above:
@mohsin
mohsin / generateSplashScreen.sh
Created September 30, 2020 11:46
Ionic IOS Splash Screen Generator script
#!/bin/bash -e
# Check if ImageMagick is installed
command -v convert >/dev/null 2>&1 || { echo >&2 "Requires imagemagick, but it's not installed. See http://www.imagemagick.org. Aborting."; exit 1; }
# Use the largest images as the base for generating the others
portrait="portrait.png"
landscape="landscape.png"
convert $portrait -resize 640x1136 -gravity center -background white -extent 640x1136 Default-568h@2x~iphone.png