Skip to content

Instantly share code, notes, and snippets.

DB="your_database_name"
USER="your_db_user"
PASS="your_db_pass"
HOST="database_hostname"
(
echo 'ALTER DATABASE `'"$DB"'` CHARACTER SET utf8 COLLATE utf8_general_ci;'
mysql -p $PASS -u $USER -h $HOST "$DB" -e "SHOW TABLES" --batch --skip-column-names \
| xargs -I{} echo 'ALTER TABLE `'{}'` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;'
) \
| mysql -p $PASS -u $USER -h $HOST "$DB"
@dannygsmith
dannygsmith / convert.php
Created April 21, 2019 02:24 — forked from WPEtopher/convert.php
A script for converting MySQL databases to UTF8 (tables and columns).
/*
Plugin Name: Convert WP Database to UTF-8
Plugin URI: http://topher.wpengine.com/
Description: Converts the WordPress database (both tables and columns) to UTF-8 character set.
Version: 1.1.0
Author: Topher Hota (@WPEtopher), Yihui Xie
Author URI: http://yihui.name
*/
/*
<?php
namespace KnowTheCode;
require_once( __DIR__ . '/assets/vendor/autoload.php' );
$x = 9;
$y = 0;
//$z = $x / $y;
//echo $z;
<?php
namespace KnowTheCode;
require_once( __DIR__ . '/assets/vendor/autoload.php' );
$x = 9;
$y = 0;
$z = $x / $y;
echo $z;
@dannygsmith
dannygsmith / gist:d7b547f1fe3b318cebce8a657d9a6577
Last active March 29, 2018 17:37
Install Non Wordpress Sandbox
git clone https://github.com/KnowTheCode/Non-WordPress-Sandbox .
composer install
mv composer.phar composer
chmod 750 composer
mv composer ~/bin
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '669656bab3166a7aff8a7506b8cb2d1c292f042046c5a994c43155c0be6190fa0355160742ab2e1c88d40d5be660b410') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
@dannygsmith
dannygsmith / SecureSessionHandler.php
Created March 3, 2018 02:48 — forked from eddmann/SecureSessionHandler.php
Secure session handler implementation.
<?php
class SecureSessionHandler extends SessionHandler {
protected $key, $name, $cookie;
public function __construct($key, $name = 'MY_SESSION', $cookie = [])
{
$this->key = $key;
$this->name = $name;
@dannygsmith
dannygsmith / Fragment
Created December 28, 2017 03:05
Setting up a Mac for development
# Homebrew and Cask
Install the XCode command line tools by running `xcode-select --install` in the terminal.
Install Homebrew by following the instructions on the [homebrew website](http://brew.sh).
Install Cask by following the instructions on the [cask website](https://caskroom.github.io).
# Applications
@dannygsmith
dannygsmith / _verify-repair-permissions-disk.md
Created December 11, 2017 23:57 — forked from bzerangue/_verify-repair-permissions-disk.md
Mac OS X Utilities via Terminal: (Verify and Repair: Disk Permissions AND Disk / Software Update / TimeMachine)

Verify and Repair Disk Permissions via Terminal (Mac OS X)

Verify Permissions

diskutil verifyPermissions /

Repair Permissions

diskutil repairPermissions /