Tuesday, October 25, 2016

MySQL dump and Restore

To dump in UTF-8 compatible output:

 mysqldump [db] -u[user] -p --default-character-set=utf8 > [backup.sql]  

To load it back:
 mysql -u [user] -p [db] < [backup.sql]  

Monday, September 19, 2016

Clear remote desktop entries

Yeah. Do this:
 REG DELETE "HKCU\Software\Microsoft\Terminal Server Client" /F  
 DEL /F /S /Q /A %UserProfile%\Documents\Default.rdp  
 DEL /F /S /Q /A %AppData%\Microsoft\Windows\Recent\AutomaticDestinations\1bc392b8e104a00e.automaticDestinations-ms  

Wednesday, July 13, 2016

git aliases

Want to customize git commands and their behavior? Modify your git configuration at ~/.gitconfig

Here is a simple customization:
 [alias]  
     l = log --decorate --graph --oneline --date=relative  
     st = status -s  

Tuesday, June 28, 2016

Troubleshooing selinux denials

First find out the denial message:

 sealert -b  
or:
 sealert -a /var/log/audit/audit.log > /path/to/mylogfile.txt   
or:
check audit log file: /var/log/audit/audit.log

After the problem is found, depending on the nature of the problem, these solutions are possible:
Access is denied to a file:
 semanage port -a -t <context_type> -p tcp <port>
Access is denied to a port:
 chcon -Rv --type=<content_type> <path>  

Where the context can be one of the selinux context types like http_port_t or httpd_sys_content_t

Monday, June 27, 2016

Backup and Restore Gitlab (omnibus only)

To backup gitlab files:
 gitlab-rake gitlab:backup:create  

The backup will be placed in: /var/opt/gitlab/backups

To restore the backup, one can use these commands:
 gitlab-ctl stop unicorn  
 gitlab-ctl stop sidekiq  
 gitlab-rake gitlab:backup:restore BACKUP=<timestamp>  
 gitlab-ctl start  
 gitlab-rake gitlab:check SANITIZE=true  

Friday, February 19, 2016

Connecting mouse and keyboard directly to a virtual machine

Just use these two line in the vmx configuration file for the machine:

 usb.generic.allowHID = "TRUE"  
 usb.generic.allowLastHID = "TRUE"