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
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;
@cdracars
cdracars / gist:e9f5aeb85de737140daf
Last active August 2, 2019 20:42
Drupal 7 Form Redirect with added Parameters.
// This will redirect the page on form load to: $base_url/node?search=FOO&reset
$form_state['redirect'] = array(
'node',
array(
'query' => array(
// adds to url: ?search=FOO
'search' => $var,
// adds to url: &reset
'reset' => NULL,
),
@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 / 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
#! /usr/bin/env bash
# Variables
APPENV=local
DBHOST=localhost
DBNAME=dbname
DBUSER=dbuser
DBPASSWD=test123
echo -e "\n--- Mkay, installing now... ---\n"
#!/bin/sh​
# Build Zsh from sources on Ubuntu.
# From http://zsh.sourceforge.net/Arc/git.html and sources INSTALL file.
# Some packages may be missing
sudo apt-get install -y git-core gcc make autoconf yodl libncursesw5-dev texinfo
git clone git://git.code.sf.net/p/zsh/code
cd zsh
$page = new stdClass();
$page->disabled = FALSE; /* Edit this to true to make a default page disabled initially */
$page->api_version = 1;
$page->name = 'access_denied';
$page->task = 'page';
$page->admin_title = 'Access Denied (403)';
$page->admin_description = '';
$page->path = 'access-denied';
$page->access = array();
$page->menu = array();
@cdracars
cdracars / gist:90596daa0c6066756b2b
Created October 17, 2014 20:29
php5-fpm rules for Aegir
<?php
/*
* Implementation of hook_provision_apache_vhost_config()
*/
function php5fpm_provision_apache_vhost_config($uri, $data) {
$plat = d()->root;
return "ProxyPassMatch ^/(.*\.php(/.*)?)$ fcgi://127.0.0.1:9000" . $plat . "/$1";
}
?>
@cdracars
cdracars / gist:db0bcdda009d952296aa
Last active August 29, 2015 14:07
IPTABLES Routing Rules

Standard routing rules

iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT -m comment --comment "Already approved traffic"
iptables -A INPUT -p tcp -i eth0 -m state --state NEW -s 0.0.0.0/0 -m multiport --dports 22,80,443 -j ACCEPT -m comment --comment "Let in the good stuff"
iptables -A INPUT -j DROP
iptables-save > /etc/iptables.rules

Create /etc/network/if-pre-up.d/iptables

vi /etc/network/if-pre-up.d/iptables