1.20.2015

Network 2 ubuntu systems via crossover cable

Got from here.
1. Pick one of the computers to be the server. If one computer has a connection to the Internet use that as the server.

2. On the server click the network indicator and chose "Edit Connections...". Select the Ethernet connection then click the "Edit..." button. Go to the IPv4 tab and change "Method" from "Automatic (DHCP)" to "Shared to other computers".

3. Connect the two computers together using an Ethernet cable. The second computer will get assigned an IP address from the server and get access to the Internet.

If you have old hardware you may need to make sure the Ethernet cable is a crossover cable. Modern hardware automatically does the crossover.
==============================================
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

Install and setup Samba on Ubuntu

Got from here.
1. Install samba
$ sudo apt-get update
$ sudo apt-get install samba

2. Set a password for samba user
$ sudo smbpasswd -a samdc
New SMB password:
Retype new SMB password:
Added user samdc.

3. Create a directory to be shared
$ sudo mkdir /data1/staging

4. Make sure user has access
$ sudo chown samdc:samdc /data1/staging

5. Make a backup copy of smb.conf
$ cp /etc/samba/smb.conf ~

6. Edit smb.conf
$ sudo vi /etc/samba/smb.conf
Add this to the very end of the file:
[staging]
path = /data1/staging
available = yes
valid users = samdc
read only = no
browseable = yes
public = yes
writable = yes

7. Restart samba
$ sudo service smbd restart

8. Check smb.conf for any syntax errors
$ testparm

9. To access network share
Linux:
smb://<HOST_IP_OR_NAME>/<folder_name>/
smb://10.42.0.1/staging/

Windows:
\\<HOST_IP_OR_NAME>\<folder_name>\
\\10.42.0.1\staging\

==============================================
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

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]-->