Skip to content

Instantly share code, notes, and snippets.

@teknikqa
teknikqa / autokey-acquia.sh
Created January 22, 2017 13:26 — forked from nhoag/autokey-acquia.sh
Auto-handling of ssh keys for Acquia Hosting
#!/bin/bash
# Acquia
CLOUDAPI_ID='id'
CLOUDAPI_KEY='key'
DOCROOT="docroot"
CREDS="${CLOUDAPI_ID}:${CLOUDAPI_KEY}"
ssh-keygen -q -b 4096 -t rsa -N "" -f ./script.key
@teknikqa
teknikqa / Rename_files.sh
Last active December 6, 2016 12:41
Rename files and all instances of old name within the files
brew install rename
# Rename all filenames from old_name to new_name
rename 's/old_name/new_name/g;' *
# Rename all instances of old_name with new_name inside the files in current directory
perl -pi -w -e 's/old_name/new_name/g;' *
# Just to be safe search for the old_name
ag old_name
@teknikqa
teknikqa / prevent_logout.py
Created December 4, 2016 13:21
Script that randomly presses 'w', 'a', 's' or 'd' every once in a while and kills itself when another key is pressed.
#!/usr/bin/env python3
import datetime
import random
import subprocess
import sys
import time
import threading
import keylogger
WASD = ['w', 'a', 's', 'd']
def random_time(minimum=30, maximum=60):
@teknikqa
teknikqa / gitLatexDiff.sh
Created December 4, 2016 13:14
Creates a diffed latex document comparing your recent uncommitted changes to your git last commit.
#!/bin/bash
#This script creates a diffed latex document comparing your recent uncommitted changes to your git last commit.
#
# ./gitLatexDiff.sh "folder path containing the git repository"
#
#You need to make sure that the current version at least compiles.
#
#The file and folder structure:
#
@teknikqa
teknikqa / sort_files.sh
Created December 4, 2016 13:13
Categorize files into sub-directories based on their file type.
#!/bin/bash
die () {
echo -e "\033[0;31m$*\033[m" >&2
exit 1
}
DIR=${1:-.}
if [ ! -d "$DIR" ]; then
@teknikqa
teknikqa / full_width.html
Created July 25, 2016 13:13
CSS to create a full width container inside a fixed width container. Works on IE9 and above.
<div class="container" style="width: 750px; margin: 0 auto;">
<div class="row-full">
--- Full width container ---
</div>
</div>
@teknikqa
teknikqa / gist:5c9b5367d32fb6ad66cc20303c46f384
Created July 21, 2016 13:24 — forked from heathdutton/gist:cc29284de3934706acd1
Start an Acquia drush command, and wait for it to complete before continuing.
#!/bin/bash
# Runs an acquia task, and waits for the task to complete before continuing.
# This is a helper script, to be used in others as needed.
if [[ $1 = "" ]] || [[ $2 = "" ]]
then
echo "Runs an acquia drush command, waiting for the results before continuing."
echo "Can be used as a replacement for drush."
echo
echo " Usage: $0 <site-alias> <ac-drush-command>"
@teknikqa
teknikqa / 50_purge_varnish.sh
Created July 21, 2016 13:09 — forked from heathdutton/50_purge_varnish.sh
Acquia Cloud hook for flushing Varnish .com domains securely.
#!/bin/bash
#
# Cloud Hooks: code-deploy, code-update, db-copy, web-activate
# Essentially any time code or db changes are made.
#
# Purges Varnish cache for all .com domains assigned to the environment in Acquia Cloud.
site="$1"
target_env="$2"
drush_alias=$site'.'$target_env
@teknikqa
teknikqa / logs
Created July 21, 2016 12:10 — forked from heathdutton/logs
Get Acquia enterprise logs from a quick command line shell
#!/bin/bash
# Retrieves past and present logs for a site in Acquia Enterprise
# Put this in your /usr/local/bin folder and chmod it 0755
# Then you can search/view logs quickly from any terminal
if [ "$1" = "" ] || [ "$2" = "" ]
then
echo "Retrieves past and present logs for a site in Acquia Enterprise"
echo "Usage: $0 <site-alias> <site-environment>"
echo "Example: $0 qrk test"
@teknikqa
teknikqa / drupal-clear-cache-sql.sh
Last active July 17, 2016 08:34
Clear all caches in Drupal using SQL
#!/usr/bin/env bash
# Clear cache of the following tables using the Drush SQL command
# The SQL commands can also be used directly in MySQL
drush sql-cli
TRUNCATE TABLE cache;
TRUNCATE TABLE cache_block;
TRUNCATE TABLE cache_bootstrap;
TRUNCATE TABLE cache_field;
TRUNCATE TABLE cache_filter;