Skip to content

Instantly share code, notes, and snippets.

View mahdi-malv's full-sized avatar

Mahdi Malvandi mahdi-malv

View GitHub Profile
@mahdi-malv
mahdi-malv / ipad_bulk_uninstall.sh
Created March 23, 2024 11:56
Bulk remove apps from iOS or iPadOS using idb (fbidb.io)
#!/bin/bash
DEVICE_UDID=""
# Run the command and store the result in a variable
apps=$(idb list-apps --udid "$DEVICE_UDID")
echo "$apps" | while IFS= read -r app; do
# Parse the app details
id=$(echo "$app" | cut -d '|' -f 1 | tr -d '[:space:]')
@mahdi-malv
mahdi-malv / todo-pre-commit.sh
Last active March 6, 2024 16:25 — forked from shahin-you/pre-commit
Block the commit if there was unmentioned TODO
#!/bin/sh
# Check for "TODO" in staged files
TODO_FOUND=$(git diff --cached --name-only --diff-filter=AM | grep -E '\.(kt|java|xml|kts|properties)$' | xargs -r grep -l 'TODO')
if [ ! -z "$TODO_FOUND" ]; then
echo "🔴 These TODOs are not refering to any task"
echo "$TODO_FOUND"
echo "Consider addressing the TODOs or creating tickets for them before committing."
# Uncomment the next line to block the commit until TODOs are addressed
@mahdi-malv
mahdi-malv / popclip-chatgpt.js
Created December 18, 2023 04:07
Multi-level depth ChatGPT extension for popclip
// #popclip extension for ChatGPT
// name: ChatGPT Quick Actions
// icon: iconify:logos:openai-icon
// language: javascript
// module: true
// entitlements: [network]
// options: [{
// identifier: apikey, label: API Key, type: string,
// description: 'Obtain API key from https://platform.openai.com/account/api-keys'
// }]
@mahdi-malv
mahdi-malv / gitcommit.yml
Created December 15, 2023 01:52
Git commit generator using GPT3.5 (GptCLI)
# Add it in ~/.local/gpt-cli/gitcommit
# Use "gptcli gitcommit" to generate a commit message
name: gitcommit
description: "ai commit plugin for gpt cli"
repository: "mahdi-malv"
author: "mahdi-malv"
help: |
Creates commit based on git diff and created to do better than GitKraken
@mahdi-malv
mahdi-malv / bard_multi_level_conversation-1.txt
Created December 7, 2023 20:15
Multi-level depth conversation with Bard (paste before starting the chat) - v1
Let's have a chat and discussion about some different topics. But there's an important tip that you need to take into account when trying to respond to me.
I want you to adjust the preciseness and depth of the conversation based on a Level that I specify on each prompt I write to you.
"L1": Level 1, Respond with the shortest and most precise answer
"L2": Level 2, Respond with more details, providing a small overview of the whole thing about the prompt
"L3": Level 3, go a bit more detailed and comprehensive that Level 2. provide more details.
"L4": Level 4, when specified, try to respond with as much details and you can while keeping the conversation not too long.
"L5": Level 5, explain in the most detailed possible way providing a clear and complete response with examples, references and everything needed to give a complete answer
Note: If no level was specified, assume Level 1 is requested.
@mahdi-malv
mahdi-malv / code.yml
Created December 2, 2023 23:56
gptcli plugin to be a coding assistant
# Put it in ~/.config/gpt-cli/code/code.yml
# add an alias for simplicity
# alias 'c?'='gptcli code'
name: code
description: "AI assistant for code"
author: "mahdi-malv"
help: |
code ask plugin for gptcli
Usage:
@mahdi-malv
mahdi-malv / ask.yml
Last active December 2, 2023 02:21
gptcli plugin to allow multiple depth level of response
# Write the file in .config/gpt-cli/plugins/ask/ask.yml
# Create an alias to make the usage even simpler
# alias 'q?'='gptcli ask'
# will make it as simple as → q? "How far is the damn moon?" L1
name: ask
description: "normally ask something from AI"
author: "mahdi-malv"
@mahdi-malv
mahdi-malv / configure_dns.sh
Created July 11, 2022 21:03 — forked from smhdhsn/configure_dns.sh
Dynamic shecan.ir configurator.
#! /bin/bash
#####################################################
# Fetch DNS configurations from shecan.ir #
#####################################################
set -e
reset=`tput sgr0`
red=`tput setaf 1`
static boolean isApplicationForeground(Context context) {
KeyguardManager keyguardManager =
(KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
if (keyguardManager != null && keyguardManager.isKeyguardLocked()) {
return false;
}
ActivityManager activityManager =
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
@mahdi-malv
mahdi-malv / remove-build.sh
Created July 8, 2021 12:27
Remove build directories of IntelliJ projects with python3
python3 -c """
import shutil
import glob
for i in glob.glob('**/build/',recursive=True):
print(f'Deleting {i}')
try:
shutil.rmtree(i)
except OSError:
print(f'Failed to remove {i}')