Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / 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 / 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 / convert.md
Last active May 3, 2018 07:25
Convert AVI videos to WEBM & MP4 videos for use in webpage backgrounds.

MP4

Pass 1

ffmpeg -i input.avi -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:720 -threads 0 -pass 1 -an -f mp4 /dev/null

Pass 2

ffmpeg -i input.avi -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:720 -threads 0 -pass 2 -an -f mp4 output.mp4

@teknikqa
teknikqa / lastfm_delete_loved.js
Created May 7, 2017 06:38
Bulk delete Last.FM scrobbles & loved tracks
// On the Last.FM website go to the page which lists the tracks that you have loved.
// Open Chrome DevTools (or Firefox or any modern browser that has a built in Javacript Console)
// and run the following command.
// This basically clicks on all the delete buttons on the page and reloads the page.
jQuery('.love-button--loved').each(function(_, b) {
b.click();
});
location.reload();