Skip to content

Instantly share code, notes, and snippets.

View cdracars's full-sized avatar
🎯
Focusing

Cody Dracars cdracars

🎯
Focusing
  • CFS Brands, LLC
  • Oklahoma City Oklahoma
  • X @cdracars
View GitHub Profile
@cdracars
cdracars / gist:b29f0ca62c6ac27cffea
Created May 12, 2015 21:07
Status of all git repos in directory.
find ~ -type d -name .git -exec dirname {} \; | tr '\n' '\000' | xargs -0 -n1 -I % git -C "%" status
@cdracars
cdracars / permissions.sh
Created August 24, 2015 15:57
Bash script to fix Drupal file and directory permissions copied from https://www.drupal.org/node/244924.
#!/bin/bash
# Help menu
print_help() {
cat <<-HELP
This script is used to fix permissions of a Drupal installation
you need to provide the following arguments:
1) Path to your Drupal installation.
2) Username of the user that you want to give files/directories ownership.
@cdracars
cdracars / git-multi-status.sh
Created August 28, 2012 20:27 — forked from aroberts/git-multi-status.sh
Script for checking git status of many git repositories
#!/bin/bash
# usage: $0 source_dir [source_dir] ...
# where source_dir args are directories containing git repositories
red="\033[00;31m"
green="\033[00;32m"
yellow="\033[00;33m"
blue="\033[00;34m"
purple="\033[00;35m"
@cdracars
cdracars / gist:5594846
Last active December 17, 2015 10:28
Drupal Module Rename Code.
#!/bin/bash
# Module Rename script. Written by cdracars 2013
NAME=`find . -type f -name *.module | cut -c 3- | cut -d'.' -f1`
echo "Please enter a new name for the module."
read VAR
VAR1='windows' # String to be found.
VAR2='liniux' # String that will replace found string.
mysql -u root
SELECT PASSWORD('MYFANCYPASSWORD')
copy the output hash * and all.
CREATE USER 'myfancyusername'@'%' IDENTIFIED BY PASSWORD '*HASH';
GRANT ALL PRIVILEGES ON *.* TO 'myfancyusername'@'%' WITH GRANT OPTION;
# <type>(<scope>): <subject>
#|<---- Using a Maximum Of 50 Characters ---->|
# <body>
#|<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# <footer>
# Example: Closes #23
# --- COMMIT END ---
#!/bin/bash
# bash generate random alphanumeric string
#
# bash generate random 32 character alphanumeric string (upper and lowercase) and
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
# bash generate random 32 character alphanumeric string (lowercase only)
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
#!/bin/sh -e
# Delete all stopped containers (including data-only containers).
docker ps -a -q --no-trunc --filter "status=exited" | xargs --no-run-if-empty docker rm -v
# Delete all tagged images more than a month old
# (will fail to remove images still used).
docker images --no-trunc --format '{{.ID}} {{.CreatedSince}}' | grep ' months' | awk '{ print $1 }' | xargs --no-run-if-empty docker rmi || true
# Delete all 'untagged/dangling' (<none>) images
@cdracars
cdracars / gist:6ca1eb643d3dd1ef29bafa97a102b164
Created April 25, 2019 20:08
MacOs Slack Dark Mode App/Script (You can Use appify[https://gist.github.com/mathiasbynens/674099] to turn this into an app)
#!/usr/bin/env bash
# If the file has already been modified don't try and modify it again
if grep -Fq "slack-night-mode" /Applications/Slack.app/Contents/Resources/app.asar.unpacked/src/static/ssb-interop.js; then
/usr/bin/osascript <<EOA
tell app "System Events"
display notification "Dark Mode enabled previously.\rYou have made your choice to forsake the Light Mode." with title "Slack Dark Mode"
end tell
EOA
exit 0;