1.07.2015

Prepare FC19 for RabbitMQ development

Got RabbitMQ install from here and here.

Install Erlang

1. $ sudo yum install erlang

Install RabbitMQ from RPM

2. $ sudo rpm --import http://www.rabbitmq.com/rabbitmq-signing-key-public.asc 3. $ sudo rpm -Uvh http://www.rabbitmq.com/releases/rabbitmq-server/v3.4.3/rabbitmq-server-3.4.3-1.noarch.rpm (or grab latest here)

Configure RabbitMQ SSL

TODO: outline steps

Install RabbitMQ management console

4. $ sudo rabbitmq-plugins enable rabbitmq_management

Open Firewall

5. $ firewall-cmd --permanent --add-port=5672/tcp 6. $ firewall-cmd --reload 7. $ setsebool -P nis_enabled 1

Start RabbitMQ as a daemon by default

8. $ sudo chkconfig rabbitmq-server on # To start the service: /sbin/service rabbitmq-server start # To stop the service: /sbin/service rabbitmq-server stop # To restart the service: /sbin/service rabbitmq-server restart # To check the status: /sbin/service rabbitmq-server status

Open RabbitMQ management UI

10. Browse to http://localhost:15672/

Install Bunny (Ruby Development)

9. $ gem install bunny Fetching: amq-protocol-1.9.2.gem (100%) Successfully installed amq-protocol-1.9.2 Fetching: bunny-1.6.3.gem (100%) Successfully installed bunny-1.6.3 2 gems installed Enjoy!

1.06.2015

p4 diff output colorizer

Create a ruby file p4c.rb:
#!/usr/local/bin/ruby -w
# encoding: UTF-8
#
# A simply `p4 diff` output colorizer.
# Got this from:
# http://writequit.org/blog/?p=341

FILE_R = /^====\s+([\s\S]+)(#\d+) - ([\s\S]+) ====$/
POS_R  = /^(\d+[ad]\d+)$/
OUT_R  = /^< /
IN_R   = /^> /

## Escape sequences for colors
## Misc
$RESET = "\033[0m"
$BOLD = "\033[1m"
$BLINK = "\033[5m"

## Foreground colors
$BLACK = "\033[30m"
$RED = "\033[31m"
$GREEN = "\033[32m"
$BROWN = "\033[33m"
$BLUE = "\033[34m"
$MAGENTA = "\033[35m"
$CYAN = "\033[36m"
$WHITE = "\033[37m"

$stdin.each_line do |line|
  line.chomp!
  if line =~ FILE_R
    puts "#{$MAGENTA}" + line + "#{$RESET}"
  elsif line =~ POS_R
    puts "#{$CYAN}" + line + "#{$RESET}"
  elsif line =~ OUT_R
    puts "#{$RED}" + line + "#{$RESET}"
  elsif line =~ IN_R
    puts "#{$GREEN}" + line + "#{$RESET}"
  else
    puts line
  end
end
You can call it like this...
$ p4 diff Module.pm | ~/bin/p4c.rb
# or with an alias: colorize='~/bin/p4c.rb'
$ p4 diff Module.pm | colorize

My .aliases

My collection of bash knick knacks.
alias 2proj='cd /auto/home/samdc/projects'

# cd to a directory that is relative to 2proj directory
function 2p() { 2proj && cd $@ ;}

# list resources files
# use: res filename*
function res() { 2proj && cd common/resources/ && ls -l */$@ ; }

# diff color
alias colorize='~/bin/p4c.rb'

1.05.2015

Things to do after installing Ubuntu 14.10 Utopic Unicorn

I got this from here, here, here and here.
1. Enable partner repository
$ sudo sed -i "/^# deb .*partner/ s/^# //" /etc/apt/sources.list && apt-get update

2. Download and Install GetDeb and PlayDeb
$ echo "Downloading GetDeb and PlayDeb" &&
wget http://archive.getdeb.net/install_deb/getdeb-repository_0.1-1~getdeb1_all.deb http://archive.getdeb.net/install_deb/playdeb_0.3-1~getdeb1_all.deb &&
echo "Installing GetDeb" &&
sudo dpkg -i getdeb-repository_0.1-1~getdeb1_all.deb &&
echo "Installing PlayDeb" &&
sudo dpkg -i playdeb_0.3-1~getdeb1_all.deb &&
echo "Deleting Downloads" &&
rm -f getdeb-repository_0.1-1~getdeb1_all.deb &&
rm -f playdeb_0.3-1~getdeb1_all.deb

3. Add PPAs (Personal Package Archives)
$ sudo add-apt-repository -y ppa:videolan/stable-daily
$ sudo add-apt-repository -y ppa:otto-kesselgulasch/gimp
$ sudo add-apt-repository -y ppa:gnome3-team/gnome3
$ sudo add-apt-repository -y ppa:webupd8team/java
$ sudo add-apt-repository -y ppa:webupd8team/y-ppa-manager
$ sudo add-apt-repository -y ppa:transmissionbt/ppa
$ echo 'deb http://download.videolan.org/pub/debian/stable/ /' | sudo tee -a /etc/apt/sources.list.d/libdvdcss.list &&
echo 'deb-src http://download.videolan.org/pub/debian/stable/ /' | sudo tee -a /etc/apt/sources.list.d/libdvdcss.list &&
wget -O - http://download.videolan.org/pub/debian/videolan-apt.asc|sudo apt-key add -

4. Update and upgrade
$ sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade

5. Install essentials
$ sudo apt-get install synaptic vlc gimp gimp-data gimp-plugin-registry gimp-data-extras y-ppa-manager bleachbit openjdk-7-jre oracle-java8-installer flashplugin-installer unace unrar zip unzip p7zip-full p7zip-rar sharutils rar uudeview mpack arj cabextract file-roller flac faac faad sox ffmpeg2theora libmpeg2-4 uudeview mpeg3-utils mpegdemux liba52-dev mpeg2dec vorbis-tools id3v2 mpg321 mpg123 libflac++6 totem-mozilla icedax lame libmad0 libjpeg-progs libdvdcss2 libdvdread4 libdvdnav4 ubuntu-restricted-extras ubuntu-wallpapers*

6. Install additional drivers
Open Software & Updates > Additional Drivers, install as needed

7. Install Google Chrome
$ wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb &&
sudo dpkg -i google-chrome-stable_current_amd64.deb &&
rm -f google-chrome-stable_current_amd64.deb

8. Install VirtualBox
Verify if virtualbox packages are included in multiverse repository
$ apt-cache policy virtualbox
virtualbox:
   Installed: (none)
   Candidate: 4.3.18-dfsg-1
   Version table:
   4.3.18-dfsg-1 0
        500 http://in.archive.ubuntu.com/ubuntu/ utopic/multiverse amd64 Packages

Update repository then install
$ sudo add-apt-repository multiverse
$ sudo apt-get update
$ sudo apt-get install virtualbox

9. Install TrueCrypt
To install:
sudo add-apt-repository ppa:stefansundin/truecrypt
sudo apt-get update
sudo apt-get install truecrypt

To automatically grant TrueCrypt sudo powers, edit sudoers with "sudo visudo" and add this (important: add it to the end of the file!):
your_username ALL=(ALL) NOPASSWD:/usr/bin/truecrypt

Using "sudo visudo" makes sure you don't damage the file and prevent your system to boot. Never edit the sudoers file directly. If you're wondering why TrueCrypt exits when you hide it, go to Preferences » Background Task » uncheck "Exit when there are no mounted volumes".

10. Install vim with perl/python/ruby support
$ sudo apt-get remove vim-tiny vim vim-nox
$ sudo apt-get build-dep vim
$ sudo apt-get install mercurial
$ hg clone https://vim.googlecode.com/hg/ vim74
$ cd vim74
$ ./configure --enable-perlinterp --enable-pythoninterp --enable-rubyinterp --enable-cscope  --with-features=huge --prefix=/usr
$ sudo make
$ sudo make install

11. Adjust privacy
System Settings > Security & Privacy
Files & Applications - turn OFF
Search - turn OFF

12. Disable system crash reports
$ sudo vim /etc/default/apport
Change to: enabled=0
$ sudo service apport stop

13. Show menus in window's title bar
System Settings > Appearance > Behavior

14. Change display scale
System Settings ~ Displays ~ Scale for menu and title bars ~ adjust to 0.875

15. Install TweakTools or Unity Tweak Tools
$ sudo apt-get install unity-tweak-tool gnome-tweak-tool
Open Unity Tweak Tool and select "Minimize single window applications on click"

16. Install Skype

17. Install dupeGuru
$ sudo add-apt-repository ppa:hsoft/ppa
$ sudo apt-get update
$ sudo apt-get install dupeguru*

18. Install Unison
$ sudo apt-get install unison unison-gtk

19. To watch silverlight based video streams (HBO Go, etc)
$ sudo add-apt-repository ppa:mjblenner/ppa-hal
$ sudo apt-get update
$ sudo apt-get install hal
$ cd ~/.adobe/Flash_Player
$ rm -rf NativeCache AssetCache APSPrivateData2
$ sudo add-apt-repository ppa:pipelight/stable
$ sudo apt-get update
$ sudo apt-get install --install-recommends pipelight-multi
$ sudo pipelight-plugin --update
$ sudo pipelight-plugin --enable silverlight

20. Card reader support
$ sudo apt-get install exfat-fuse exfat-utils

21. Clean up
echo "Cleaning Up" &&
sudo apt-get -f install &&
sudo apt-get autoremove &&
sudo apt-get -y autoclean &&
sudo apt-get -y clean
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case

Best Way to Check Version of IE?

Just add this to the page...
<!--[if lt IE 9 ]>
<script>
var is_ie_lt9 = true;
</script>
<![endif]-->
Or in my case, I just wanted to display that they are using IE 8, then suggest to use a different browser...
<!--[if lte IE 8]>
    <h2 style="background-color:red;color:white;text-align:center;padding:10px;">You are using Internet Explorer 8 or older.  Please use Firefox or Chrome for proper display of this page.</h2>
<![endif]-->

1.04.2015

Add and Delete Users on Ubuntu 14.10

1. Create user
samdc@mango:~$ sudo adduser raqueldc
[sudo] password for samdc: 
Adding user `raqueldc' ...
Adding new group `raqueldc' (1001) ...
Adding new user `raqueldc' (1001) with group `raqueldc' ...
Creating home directory `/home/raqueldc' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for raqueldc
Enter the new value, or press ENTER for the default
 Full Name []: Raquel
 Room Number []: 
 Work Phone []: 
 Home Phone []: 
 Other []: 
Is the information correct? [Y/n] 

2. Delete user
Delete account:
samdc@mango:~$ sudo userdel newuser
Delete home directory
samdc@mango:~$ sudo rm -rf /home/newuser
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case

Move home dir to another drive

Got it from here.
First install the drive, then follow these steps:
1. Find UUID of the partition
root@mango:~# blkid 
/dev/sdb1: UUID="8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2" TYPE="ext4" PARTUUID="0835b8cd-01"

2. Modify fstab
root@mango:~# vim /etc/fstab
Add this line
UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /media/home          ext4    defaults        0       2

3. Create temporary mount point
root@mango:~# mkdir /media/home

4. Reload fstab
root@mango:~# mount -a

5. Copy /home to new partition
root@mango:~# rsync -aXS --exclude='/*/.gvfs' /home/. /media/home/.

6. Prepare fstab for the switch
root@mango:/home/samdc# vim /etc/fstab
Modify this line to:
UUID=8b1e1564-d7b6-4ef4-9ffd-d7d191251cc2 /home          ext4    defaults        0       2

7. Do the switch
root@mango:~# cd / && sudo mv /home /old_home && sudo mkdir /home

8. Reload fstab
root@mango:/# mount -a

9. Delete old home
root@mango:/# rm -r /old_home

10. Reboot
==============================================
hostname:mango, os:Ubuntu 14.10 Utopic Unicorn
==============================================
ASRock Z97 Extreme6 LGA 1150 Intel Z97 HDMI SATA 6Gb/s USB 3.0 ATX Intel Motherboard
Intel Core i7-4790 Haswell Quad-Core 3.6GHz LGA 1150 84W Desktop Processor Intel HD Graphics 4600
Team Xtreme 16GB (2 x 8GB) 240-Pin DDR3 SDRAM DDR3 2400 Desktop Memory
OCZ ARC 100 ARC100-25SAT3-240G 2.5" 240GB SATA III MLC Internal Solid State Drive
Western Digital WD Blue WD10EZEX 1TB 7200 RPM 64MB Cache SATA 6.0Gb/s 3.5" Internal Hard Drive
ENERMAX Ostrog GT ECA3280A-BR Black / Red Steel / Plastic ATX Mid Tower Computer Case