Skip to content

Instantly share code, notes, and snippets.

@teknikqa
teknikqa / Installation.md
Created July 25, 2022 06:23 — forked from albertbori/Installation.md
Automatically disable Wifi when an Ethernet connection (cable) is plugged in on a Mac

Overview

This is a bash script that will automatically turn your wifi off if you connect your computer to an ethernet connection and turn wifi back on when you unplug your ethernet cable/adapter. If you decide to turn wifi on for whatever reason, it will remember that choice. This was improvised from this mac hint to work with Yosemite, and without hard-coding the adapter names. It's supposed to support growl, but I didn't check that part. I did, however, add OSX notification center support. Feel free to fork and fix any issues you encounter.

Most the credit for these changes go to Dave Holland.

Requirements

  • Mac OSX 10+
  • Administrator privileges
@teknikqa
teknikqa / deleteAmazonSavedItems.js
Created May 19, 2019 08:44 — forked from MichaelLawton/deleteAmazonSavedItems.js
Removes all Amazon saved for later items on the cart page. It will only remove visible items. You might want to scroll first to make more items visible. To use paste code in developer console (Ctrl+Shift+J or Cmd+Opt+J in Chrome) then press enter.
function deleteSavedItems() {
var query = document.querySelectorAll("#sc-saved-cart input[value=Delete]")
if (query.length) {
query[0].click();
}
if (query.length > 1) {
setTimeout(deleteSavedItems,100);
}
else {
console.log('Finished');
@teknikqa
teknikqa / git add certain file types
Created May 9, 2019 07:11 — forked from stoplion/git add certain file types
git add all of certain file type
find . -name "*.sass" | xargs git add
@teknikqa
teknikqa / fix-files-directories-permission-php.php
Created September 4, 2018 06:49 — forked from yuseferi/fix-files-directories-permission-php.php
Fix Files Directories Permissions by PHP code
<?php
fix_file_directory_permission(dirname(__FILE__));
function fix_file_directory_permission($dir, $nomask = array('.', '..')) {
if (is_dir($dir)) {
// Try to fix directories permission
if (@chmod($dir, 0755)) {
echo "<p>Permission Fixed for : " . $dir . "</p>";
}
}
@teknikqa
teknikqa / drupalvm-setup.sh
Created January 7, 2018 13:35 — forked from kyletaylored/drupalvm-setup.sh
A shell script to help set up a standard DrupalVM project
#!/bin/bash
# Get project directory and git url
echo "Project code (used for project directory name):"
read project_code
echo "Project repo git url (can be blank):"
read project_git_url
# Clone DrupalVM
git clone git@github.com:geerlingguy/drupal-vm.git $project_code
@teknikqa
teknikqa / html.tpl.php
Created October 18, 2017 11:46 — forked from pascalduez/html.tpl.php
Drupal 7 — Move $scripts at page bottom
<!DOCTYPE html>
<html<?php print $html_attributes; ?>>
<head>
<?php print $head; ?>
<title><?php print $head_title; ?></title>
<?php print $styles; ?>
<?php print $head_scripts; ?>
</head>
<body<?php print $body_attributes;?>>
@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 / 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"