12/04/2016

Attention: Turns out there are a few bugs which basically make mysql-utilities not usable atm.

On Ubuntu 16.04LTS install
sudo apt-get install mysql-utilities
To create a login-path run the followng, which will first prompt you to enter a password and then save the information.
mysql_config_editor set --login-path=prod --host=localhost --user=root --password
Once saved, you can use it like so:
mysql --login-path=prod
At the time of writing, the available options are:
host        no default value)
login-path  client
user        no default value
socket      no default value
port        no default value 
To print all the login-paths that are configured run:
mysql_config_editor print --all
If you need to remove an existing login-path use
mysql_config_editor remove --login-path=prod

10/13/2015

If you are tired of having to repeat your git password over and over: https://git-scm.com/docs/git-credential-store

2/09/2015

VIM configuration

Copy the vimrc_example.vim to your home dir cp /usr/share/vim/vim73/vimrc_example.vim ~/.vimrc Download http://www.vim.org/scripts/script.php?script_id=2465 Place in ~/.vim/colors (if folder does not exist, create it) Open the copied .vimrc and append the following two lines: set bg=dark colorscheme wombat256mod

1/04/2015

MySQL: How to clone a database

Here's one way of duplicating a mysql database:
1. Make a dump of the source database: If you only want to dump the structure simply add --no-data to the end of the above command. 2. Open up a MySQL shell: 3. Within the MySQL shell, create a new database and populate it with the dumped data: 4. Optionally create a new user. Give permissions to the new database:

2/15/2014

How to: Shared Folder Permissions Denied - Virtualbox

Make sure that the user is a member of the group vboxsf. sudo adduser xxxxxxx vboxsf

How-to: Guest Additions for VirtualBox 4.3 - Debian 7 (or any of it's derivatives)

Guest Additions is picky about dkms and wanting to build kernel modules. Open the Root Terminal: apt-get install build-essential module-assistant Once installed, the module-assistant can fetch the Linux headers: m-a prepare Have the Guest Additions CD image loaded in your virtual CD drive (VirtualBox "Devices" menu), but don't expect Autorun to work, it only returns "Error autorunning software. Cannot find the autorun program." Don't ask. Instead, still in the Root Terminal, run: sh /media/cdrom/VBoxLinuxAdditions.run and follow the installation prompts. You can then reboot with the 3D Acceleration, display resize and auto-resolution working again.

2/14/2014

git with unverified ssl certificate

If you ever had to work with a remote repo which uses ssl (and it better!), but lacked a valid ssl certificate, you quickly realised that you can't actually work with it ;-) Solution: git config --global http.sslVerify false

2/13/2014

If you're using putty/kitty and want a color scheme that is actually useful, try the following colors:

9/07/2012

Select all in vim

Note: This will only work within vim, copying to the clipboard or when using putty is a different story...

8/21/2012

Exclude Directories with find to chown a git project

After running a git pull file permissions tend to get messed up. To fix this I added a hook after merging. I wanted to chown all directories, but exclude a couple. Here's how:

8/09/2012

Compute a good InnoDB log file size

Run these queries during your server’s peak usage time: The log sequence number is the total number of bytes written to the transaction log. Now you can see how many MB have been written to the log in one minute. (This technique works on all versions of MySQL, in 5.0 and newer, you can just watch Innodb_os_log_written from SHOW GLOBAL STATUS, too.) Say we want our logfile to hold at most an hour or so of logs, which is generally plenty of data for InnoDB to work with. For good measure we can round this up to 32MB, and considering the fact that there are two logfiles, divide by half: 16MB per logfile. This seems like a surprisingly small number, but you can monitor this easily enough. Word of advice though: be sure to run the above queries at your server's peak time, or your results might be seriously skewed. Consider running the above multiple times a day over a course of a couple days, and use the average value, so you are on the safe side. That being said, in this particular case, memory being so cheap, I would simply set the log file size to 64MB and be done ;-)

Update: To run this multiple times using a script: https://github.com/datune/innodb_log_file_size

8/04/2012

Compiling GIT on Ubuntu

While configuring the new webserver for the company I work at, I noticed that the git version that can be installed with the package manager is way behind the current git version, so I decided I was going to compile it from source, and while I was at it, create a .deb file so I can easily install it on other servers as well without having to recompile. Let's make sure we have everything installed and all dependencies are met so we can actually compile git. Next download the source code by either downloading directly from http://github.com/git/ or if you have git installed you can also just: Because I already have git installed, and I want to update it, I simply remove it first: Now cd into the git directoy and do the following: This will check all dependencies. Next let's install into /usr and not /usr/local, just like Ubuntu, and we want to have everything, incl. documentation, so we add all to the command, like so: This will take a while, but once it is finished, I COULD simply install it like so: but, that's not what I want. Instead, I want to create a .deb package. First let's create a description file for our package: Add the following in the file: Now we're ready to create the .deb file The -D tells it to create a .deb package, --install=no means we do not want to install it right away. (Btw. if you do not have checkinstall, simply run sudo apt-get checkinstall). When asked to create a documentation directory, simply enter y. Next change the maintainer to your email, and make sure to change the Name (2) to git-core! Add the version like so 1:1.7.12:04.08.12, where 04.08.12 is the current date. Having done all that, just hit ENTER and watch it build our deb package. After that, all that's left is to actually install our package: Btw. here's a useful link which also explains how to install git on Ubuntu: http://evgeny-goldin.com/blog/3-ways-install-git-linux-ubuntu/

7/28/2012

Get system vitals and highest utilizing process

At times it may be handy to periodically store a snapshot of the server's system vitals.

2/09/2012

Restore file permissions

I didn't test it but it must work for owners and owner groups too. Something like:

2/07/2012

Find a directory by name in linux

-type d == directory
-name '.svn' == all directories named .svn
-ls == converts unusual characters to C style escape sequences

To delete the list of directories returned by the above command execute xargs builds and executes command lines from standard input
/bin/rm -dr == remove command with the directory and recursive flags

2/01/2012

Group Sticky bit

To ensure that the group owner of existing and new files stays the same set the group sticky bit like so:

1/16/2012

List installed packages

5/10/2011

Debian adduser

Debian / Ubuntu: Add to sudo group (Debian / Ubuntu specific step):

11/01/2010

Ubuntu - find current graphics card model

lspci | grep VGA

More detailed information can be found by running:
sudo lshw -C video