Skip to content

Instantly share code, notes, and snippets.

View deekayen's full-sized avatar
🏡
Working from home

David Norman deekayen

🏡
Working from home
View GitHub Profile
@shrop
shrop / CrashPlan Pause-Resume.scpt
Created March 29, 2014 20:46
CrashPlan Pause/Resume
set isCrashPlanRunning to false
try
set pid to do shell script ¬
"sudo launchctl list | grep com.crashplan.engine" user name "username" password ¬
"password" with administrator privileges
set isCrashPlanRunning to true
end try
if isCrashPlanRunning then
log "CrashPlan is already running: " & pid
anonymous
anonymous / trim_drupal_node_revisions.sql
Created October 3, 2014 17:58
Delete revisions from the Drupal 7 node_revisions table such that only the newest 3 revisions remain for each node. It joins on the node table to make sure that the current, active vid assigned in the node table doesn't get deleted.
DELETE FROM node_revisions WHERE vid IN (
SELECT subquery.vid FROM (
SELECT @row_num := IF(@prev_value=nr.nid,@row_num+1,1) AS RowNumber
,nr.nid
,nr.vid
,nr.timestamp
,@prev_value := nr.nid
FROM node_revisions nr,
(SELECT @row_num := 1) x,
(SELECT @prev_value := '') y
anonymous
anonymous / site-db-backup
Created December 28, 2012 15:34
Backup a Drupal site's database using drush, minus disposable data.
#!/bin/bash
# Check for the existance of drush on the system
if [[ ! -x /bin/drush || ! -x /usr/bin/drush ]]; then
echo "This script requires drush!"
echo
exit 3
fi
if [[ -z ${1} ]]; then
@shrop
shrop / rebuild-perms.php
Last active December 30, 2015 04:19
Rebuild permissions for running via Drush (no batch process)
<?php
/**
* @file
* Rebuild the node access database with no php time limits.
*/
/**
* Rebuilds the node access database (for use with drush php-script).
*
@krider2010
krider2010 / .profile
Last active November 29, 2017 06:13
Git Signed Commits - OSX and GUIs
# This would go into .bash_profile, .bashrc, .zshrc, etc.
# Script to start the gpg-agent - in it's own file as it is also used when the machine starts up
# Be sure to update the path to wherever you place this file!
# Note, depending on shell you may not need this line enabling, if the global daemon is already running
# OK. Some shells complain, others don't!
~/bin/startup-gpg-agent.sh
# GPG
if [ -f "${HOME}/.gpg-agent-info" ]; then
@vangberg
vangberg / todo
Created September 7, 2008 19:37
Best To-Do List. Ever.
#!/bin/sh
# Best To-Do List. Ever.
#
# Usage:
# 1. Add a new item to list: `todo This needs to be fixed`
# 2. Edit the to-do list: `todo -e`
# 3. Show the current to-do's: `todo`
if [[ $1 ]]; then
if [ $1 = "-e" ]; then
@shionryuu
shionryuu / pull_all.sh
Created February 21, 2016 06:54
pull all git repositories in a directory
#!/bin/bash
# pull all git repositories in a directory
pull_repo() {
echo "pulling $1 ..."
if git pull; then # >/dev/null 2>&1
echo -e "pulling $1 succeed\n"
else
echo -e "pulling $1 failed\n"
#!/bin/bash
SCRIPT=$(basename "$0")
exitWithError () {
echo -e "$1" 1>&2
exit 1
}
usage () {
@jacobsalmela
jacobsalmela / verifyChecksum.sh
Created March 7, 2016 19:56
Displays a dialog with three checksums to prevent the installation of malware
osascript <<EOT
display dialog "MD5:
$(openssl md5 $1 | awk '{print $2}')
SHA1:
$(openssl sha1 $1 | awk '{print $2}')
SHA256:
$(openssl dgst -sha256 $1 | awk '{print $2}')" with title "$(basename $1)" with icon Caution
EOT
@garlandkr
garlandkr / ami-clean.sh
Last active March 20, 2023 08:19
Clean-up an Amazon EC2 instance before creating an AMI
#!/bin/bash
# Run this script with:
# bash <(curl -s https://gist.github.com/garlandkr/e80674b49270b0199fa6/raw/ami-clean.sh
function print_green {
echo -e "\e[32m${1}\e[0m"
}
print_green 'Clean Yum'