Skip to content

Instantly share code, notes, and snippets.

View RobbiNespu's full-sized avatar
:octocat:
Wut?

Robbi Nespu RobbiNespu

:octocat:
Wut?
View GitHub Profile
$ sudo tlp-stat
--- TLP 0.8 --------------------------------------------
+++ Configured Settings: /etc/default/tlp
TLP_ENABLE=1
TLP_DEFAULT_MODE=AC
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60
@RobbiNespu
RobbiNespu / convert_utf8_to_utf8mb4
Last active September 19, 2015 14:32 — forked from dschneider/convert_utf8_to_utf8mb4
How to easily convert utf8 tables to utf8mb4 in MySQL 5.5
# For each database:
ALTER DATABASE database_name CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
# For each table:
ALTER TABLE table_name CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# For each column:
ALTER TABLE table_name CHANGE column_name column_name VARCHAR(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
# (Don’t blindly copy-paste this! The exact statement depends on the column type, maximum length, and other properties. The above line is just an example for a `VARCHAR` column.)
@RobbiNespu
RobbiNespu / dbconversion.php
Last active September 19, 2015 14:45 — forked from sanjaybhowmick/dbconversion.php
Convert MySQL collation from utf8mb4 to utf8
<?php
$dbname = 'your-database-name';
mysql_connect('your-database-hostname', 'your-database-username', 'your-database-password');
mysql_query("ALTER DATABASE `$dbname` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci");
$result = mysql_query("SHOW TABLES FROM `$dbname`");
while($row = mysql_fetch_row($result)) {
$query = "ALTER TABLE {$dbname}.`{$row[0]}` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci";
mysql_query($query);
$query = "ALTER TABLE {$dbname}.`{$row[0]}` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci";
mysql_query($query);
@RobbiNespu
RobbiNespu / gist:c8ae9f17a4af177bd58e
Created September 19, 2015 16:55
Hide default databases from phpmyadmin
Most of the case, i never / dont need to open the default databases such information_schema, cdcol..etc
So why not just hide this from phpmyadmin ? Open C:\xampp\phpMyAdmin\config.inc.php and add code below inside that file
/* hide database from phpmyadmin */
$cfg['Servers'][$i]['hide_db'] = '^(information_schema|mysql|phpmyadmin|cdcol|foo|webauth)$';
Reload apache and mysql to see the result in phpmyadmin.. ;)
@RobbiNespu
RobbiNespu / mysql_backup.sh
Created November 1, 2015 10:11
0 0 * * * /usr/local/bin/mysql_backup.sh
#!/bin/bash
DB_BACKUP="/home/backup/mysql_backup"
DB_USER="root"
DB_PASSWD="replace_this_text_with_your_mysql_root_password_if_needed"
HN=`hostname | awk -F. '{print $1}'`
# Clear out backup directory
rm -rf $DB_BACKUP/*.sql
@RobbiNespu
RobbiNespu / gist:9c896c64053d7763036c
Created November 2, 2015 02:12
Proxy behind Wordpress CMS
define('WP_PROXY_HOST', '192.168.100.252');
define('WP_PROXY_PORT', '8080');
define('WP_PROXY_USERNAME', '');
define('WP_PROXY_PASSWORD', '');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, 127.0.0.1');
@RobbiNespu
RobbiNespu / config.php
Created November 2, 2015 02:12
Proxy behind Wordpress CMS
define('WP_PROXY_HOST', '192.168.100.252');
define('WP_PROXY_PORT', '8080');
define('WP_PROXY_USERNAME', '');
define('WP_PROXY_PASSWORD', '');
define('WP_PROXY_BYPASS_HOSTS', 'localhost, www.example.com, 127.0.0.1');
sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode monitor
sudo ifconfig wlan0 up
sudo iwconfig wlan0 mode managed
@RobbiNespu
RobbiNespu / gist:d59907b6c8f13e206cbd
Created November 11, 2015 08:55
My Ubuntu feveret command
Super+W – Spread mode, zoom out on all windows in all workspaces
Super+S – Expo mode (for everything), zooms out on all the workspaces and lets you manage windows
$ sudo gedit /etc/environment
$ source /etc/environment
$ echo $PATH