This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop all tables in a db. | |
function mysql-drop-tables { | |
if [[ $1 != "" ]]; then | |
if [[ $(get_yes "$@") != "1" ]]; then | |
echo "You are about to drop all files in the $1 database. Are you sure? (Y or N):" | |
read RESPONSE | |
fi | |
if [[ $(get_yes "$@") == "1" || $RESPONSE == "y" || $RESPONSE == "Y" ]]; then | |
mysqldump -uroot --add-drop-table --no-data $1 | grep ^DROP | mysql -uroot $1 | |
echo "$1 has been emptied!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# The easy version is `curl -s http://php-osx.liip.ch/install.sh | bash -s 7.0` | |
# It might be better to use (build-entropy-php)[https://github.com/liip/build-entropy-php] for building. | |
# Create the destinaiton folder. | |
mkdir -p /usr/local/builds/php | |
# Clone the php source (Just using the master branch). | |
git clone https://git.php.net/repository/php-src.git /usr/local/builds/php/7.x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example using cookie auth. | |
print (string) \Drupal::httpClient() | |
->get('http://example.com/node/1', [ | |
'headers' => ['Accept' => 'application/json'], | |
'cookies' => ['SESS07e0668737e9f97189850d2cf0c79892' => 'dasGegKQ6ZzEF0xvRZWWzwrl9tt7UT8fGuXrAeLC9P1'], | |
]) | |
->getBody(TRUE); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
dscl . -read /Users/$user UserShell | sed s/^UserShell:\ // |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Delete all nodes. | |
entity_delete_multiple('node', \Drupal::entityQuery('node')->execute()); | |
// Delete all files. | |
entity_delete_multiple('file', \Drupal::entityQuery('file')->execute()); | |
// Delete all taxonomy terms. | |
entity_delete_multiple('taxonomy_term', \Drupal::entityQuery('taxonomy_term')->execute()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @file | |
# NGINX Configuration file for Drupal 8 | |
# Redirect index to php. | |
location / { | |
try_files $uri @rewrite; | |
} | |
# Allow but don't log access to /favicon.ico and /robots.txt | |
location ~ (^/favicon\.ico$|^/robots\.txt$) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# @file | |
# .travis.yml - Drupal 8 Travis CI Integration | |
language: php | |
sudo: false | |
env: | |
global: | |
# The name of the moduel to run tests on (this module). | |
- DRUPAL_MODULE=example |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Creates a new snapshot of the current state of configuration. | |
*/ | |
\Drupal::service('config.manager')->createSnapshot(\Drupal::service('config.storage'), \Drupal::service('config.storage.snapshot')); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# This script is for initializing a zim and installing a pre-compiled version of octoprint. | |
# Run as root. If using sudo, use "sudo -i -u root" | |
echo "Making root writable" | |
mount -o remount,rw / | |
echo "Add some aliases for root." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Run as root. If using sudo, use "sudo -i -u root" | |
# This script is for building octoprint on a zim cubieboard. | |
# I have since moved to building a binary version of octoprint in an armhf qemu vm. | |
# I am using a build virtual machine to build octoprint. Qemu immulates armhf and | |
# is used to hostthe build machine. | |
# | |
# Debian Wheezy armhf images were obtained from: https://people.debian.org/~aurel32/qemu/armhf/ |