Skip to content

Instantly share code, notes, and snippets.

@khammami
khammami / gist:3d8cb108a8582ab59a4f0dfbf26f585a
Created February 11, 2024 09:54 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@khammami
khammami / append_text_to_line.sh
Created December 12, 2023 08:32
This will append the text "- and some additional text" to the line that matches the regular expression "This is the line" in the file "my_file.txt".
#!/bin/bash
#./append_text_to_line.sh my_file.txt "This is the line" " - and some additional text"
# Define the filename, line pattern, and text to append
filename="$1"
line_pattern="$2"
text_to_append="$3"
# Check if required arguments are provided
@khammami
khammami / clear-recent-android-projects.sh
Last active November 27, 2023 10:27
This script will dynamically identify the specific "AndroidStudio*" directory within the "Google" directory and utilize it to construct the path to the "options" subdirectory. This ensures compatibility with various Android Studio versions.
#!/bin/bash
# Identify all first-level folders under "Google" that start with "AndroidStudio"
ANDROID_STUDIO_DIRS=($(find ~/.config/Google -type d -name "AndroidStudio*"))
# Check if any Android Studio config directories were found
if [ ${#ANDROID_STUDIO_DIRS[@]} -eq 0 ]; then
echo "No Android Studio config directories found."
exit 1
fi
@khammami
khammami / disable_ssh_agent.sh
Created November 22, 2023 07:15
This will disable the SSH agent, remove your SSH keys from the agent, and configure Git to use SSH authentication, ensuring that Git prompts you for your SSH passphrase each time you push.
#!/bin/bash
# Stop the SSH agent
eval "$(ssh-agent -k)"
# Remove SSH keys from the agent
ssh-add -d
# Configure Git to use SSH authentication
git config --global credential.helper store
@khammami
khammami / checkout_all origin_branchs_in_local.txt
Created November 20, 2023 21:38
This command fetches all remote branches from the origin remote and then loops through each branch, creating a local branch with the same name and checking it out.
git fetch origin && for branch in $(git branch -r); do git checkout -b ${branch##origin/} $branch; done
@khammami
khammami / delete-android-projects.sh
Last active October 13, 2023 17:36
Clean all Android projects under user home in Ubuntu (Credit Bard)
#!/bin/bash
# Get the home directory of the current user
HOME_DIR=$(getent passwd $USER | cut -d: -f6)
# Find all folders in the home directory that contain a build.gradle or build.gradle.kts file
#ANDROID_PROJECTS=$(find $HOME_DIR -type f -and \( -name "build.gradle" -or -name "build.gradle.kts" \))
ANDROID_PROJECTS=$(find $HOME_DIR -type f -not -path "*.gradle/**" -and \( -name "build.gradle" -or -name "build.gradle.kts" \) -not -path "*app/*" -exec echo "{}" \;)
#echo "$(wc -l $ANDROID_PROJECTS) Android Projects found!"
@khammami
khammami / delete_android_projects.sh
Created October 5, 2023 10:30
Script shell generated by Bard to clean up Android projects made by the students at the end of the class.
#!/bin/bash
# Delete all Android projects under /home/
find /home/ -name "build.gradle" -type f -exec rm -rf {} \;
# Empty the download folder
rm -rf ~/Downloads/*
@khammami
khammami / check_doi.R
Created August 8, 2023 08:21
check_doi.R
#' Check for valid DOI
#'
#' This helper function checks whether a DOI is valid. The regular expression
#' is based on the one provided by CrossRef as providing the highest coverage
#' (\url{https://bit.ly/doi-regex}).
#' credit: retractcheck: Retraction Scanner
#'
#' @param doi Digital Object Identifier (string)
#'
#' @return Boolean
#!/bin/bash
# Get the current directory
current_dir=$(pwd)
# Get the list of folders in the current directory
folders=$(ls -d *)
# Remove all other folders from the current directory
for other_folder in $folders; do
#!/bin/bash
# Get the current directory
current_dir=$(pwd)
# Get the list of folders in the current directory
folders=$(ls -d *)
# Loop through the folders
for folder in $folders; do