Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ ! -d "/DisabledExtensions/AMD6000Controller.kext" ]; then
sudo mkdir /DisabledExtensions 2>/dev/null
sudo mv /System/Library/Extensions/{AMD6000Controller.kext,AMDFramebuffer.kext,AMDRadeonX3000.kext,AMDRadeonX3000GLDriver.bundle,AMDSupport.kext} /DisabledExtensions/
echo "Disable AMD Drivers Kext (Moved to /DisabledExtensions)"
else
sudo mv /DisabledExtensions/* /System/Library/Extensions/
echo "AMD Drivers restored to System Extensions"
fi
@atika
atika / template.sh
Last active August 29, 2015 14:08
Simple content generator from a template file and variables. Replace variables on a file with bash. I use it for an html email template.
#!/bin/bash
template_path="$1"
function usage (){
echo -e "Usage: template <path to template> 'var1|content' 'var2|content'...";
[[ -f "$template_path" ]] && { echo "Current variables:" $(cat $template_path |perl -ne '/#([A-Za-z1-9]+)#[^#].*/ && printf "%s, ", $1'); }
exit 1;
}
@atika
atika / bash_colors.sh
Created November 8, 2014 13:47
Display a matrice of Bash Colors in the terminal
#!/bin/bash
T='gYw'
echo -e "\n 40m 41m 42m 43m 44m 45m 46m 47m";
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' ' 36m' '1;36m' ' 37m' '1;37m';
do FG=${FGs// /}
echo -en " $FGs \033[$FG $T "
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m\033[$BG \033[0m";
done
@atika
atika / iphone-simulator-app-folder.sh
Last active November 13, 2023 14:05
Open the iOS Simulator folder containing -user defaults- plists files for your Application
#!/bin/bash
appname="$1"
[ -z $appname ] && read -p "Application name : " appname
apppath=$(find ~/Library/Developer/CoreSimulator/Devices/ -name "$appname.app" -print -quit)
if [[ ! -z $apppath ]]; then
echo "Found path for $appname app"
echo -e "\033[1;30m$apppath\033[0m"
appbundle=$(osascript -e "id of app \"$apppath\"")
@atika
atika / bash_profile.sh
Last active May 31, 2018 22:36
Some useful Shell aliases and functions for using on Mac OS X. Compatible with Bash/Zsh shells.
# Some useful Shell aliases and function for using on Mac OS X
# https://gist.github.com/atika/4bca2820b21a71858a06
# Regular Expressions
ipregx="[0-9]{2,3}\.[0-9]{2,3}\.[0-9]{2,3}\.[0-9]{2,3}" # IP Regular Expression
mailregx="[a-zA-Z0-9_-\.]+@[a-zA-Z0-9_-\.]+\.[a-z]{2,3}" # Mail Regular Expression
# ql : Show a "Quick Look" view of files
ql () { /usr/bin/qlmanage -p "$@" >& /dev/null & }
@atika
atika / ask.sh
Last active August 29, 2015 14:08
This is a general-purpose function to ask Yes/No questions in Bash, either with or without a default answer.
#!/bin/bash
# This is a general-purpose function to ask Yes/No questions in Bash, either
# with or without a default answer. It keeps repeating the question until it
# gets a valid answer.
# http://djm.me/ask
while true; do
if [ "${2:-}" = "Y" ]; then