Ubuntu MS Core Fonts Error for Wine Installation

Script: 20181209-fix-mscorefonts.txt

Fix for the below error:

$ sudo apt-get update && sudo apt-get install --reinstall ttf-mscorefonts-installer flashplugin-installer

This fix required a supplemental fix too
Refer: https://askubuntu.com/questions/766491/failure-to-download-extra-data-files-with-ttf-mscorefonts-installer-on-ubuntu

$ wget http://ftp.de.debian.org/debian/pool/contrib/m/msttcorefonts/ttf-mscorefonts-installer_3.7_all.deb
$ sudo apt-get purge ttf-mscorefonts-installer -y
$ sudo apt install ./ttf-mscorefonts-installer_3.7_all.deb

Data files for some packages could not be downloaded

The following packages requested additional data downloads after package installation, but the data could not be downloaded or could not be processed.

ttf-mscorefonts-installer

This is a permanent failure that leaves these packages unusable on your system.  You may need to fix your Internet connection, then remove and reinstall the packages to fix this problem.

SSH Onto a Remote Server to Run Commands

Refer: http://malcontentcomics.com/systemsboy/2006/07/send-remote-commands-via-ssh.html

The basic form looks something like this:

ssh systemsboy@rhost.systemsboy.edu 'ls -l'

where "systemsboy" is actually your username on the remote host, and "rhost.systemsboy.edu" is your remote system. The command you're sending is contained in single quotes.

Here is an example sending multiple commands:

ssh systemsboy@rhost.systemsboy.edu 'ls -l; ps -aux; whoami'

wherein each command is separated by a semicolon.

Finally, here is an example sending a command that requires user interaction:

ssh -t systemsboy@rhost.systemsboy.edu 'top'

Note the -t flag. That tells ssh that you'll be interacting with remote shell. Without the -t flag top will return results after which sshwill log you out of the remote host immediately. With the -t flag, ssh keeps you logged in until you exit the interactive command. The -t flag can be used with most interactive commands, including text editors like pico and vi.

Sending remote commands via ssh is incredibly handy when writing shell scripts as it allows you to run your scripts locally even if those scripts are meant to effect changes on a remote machine. I just wrote a script, for instance, that sets up vacation mail forwarding for staff members. Without these remote commands I would have had to have staff members log directly onto the mail server and run the scripts from the command line, which I don't think they'd be too happy about. With ssh remote commands, I can give them the scripts and they can run them right from their Desktops. Believe me, they much prefer this.

Flash Video Download In Ubuntu

After you do the below you can install the downloader:

The Download Program Itself (sudo apt-get install youtube-dl)
Refer: http://www.techdrivein.com/2013/08/best-youtube-videos-downloading-tool-for-ubuntu-youtube-dl.html

Usage:
youtube-dl -f mp4 https://www.youtube.com/watch?v=pdz5kCaCRFM

Ideas for Download Solutions:
Refer: http://www.techdrivein.com/2013/08/best-youtube-videos-downloading-tool-for-ubuntu-youtube-dl.html

How to Upgrade to Get Latest Version:
Refer: http://askubuntu.com/questions/429746/youtube-dl-stopped-working

Youtube updates his anti-download security system quite offen. You should keep your youtube-dl up-to-date. The version Ubuntu 12.04 Precis installs by default is 2012.02.27 (two years old).

You can subscribe to the WebUpd8 PPA to get new releases when they're out (that is once or twice a week) :

$ sudo add-apt-repository ppa:nilarimogard/webupd8 -y
$ sudo apt-get update
$ sudo apt-get dist-upgrade

You'll also find the .deb package of the latest youtube-dl release on that PPA (here and search for youtube-dl). Install it with a GUI-tool like gdebi or Ubuntu Software Center, or with these command lines :

$ cd directory/where/you/downloaded/the/package
$ dpkg -i youtube-dl*
$ sudo apt-get install -f

Simple replace with sed command

Here's an example to scan/replace recursively:

grep -lr -e ' ' * | xargs sed -i 's/ //g'

Another sample:

echo "/tmp/testme.txt" | xargs sed -i 's/XXX/YYY/g'

Another sample, the dash i parameter makes it replace inline

sed -i 's|/bin/zip|/usr/bin/zip|g' testme.txt

Using sed with an input file:

sed -f sed.txt input.txt

input.txt

1 two three 1
four 5 six

sed.txt

s/1/one/g
s/5/five/

With the following sed commands

  • delete lines with [Control]
  • replace ? with a space
  • delete any lines that contain ONLY white space
  • delete any trailing white space
  • replace Word dash with a simple -
  • replace > < with ><
  • G tells sed to double space the output file

sed.txt

/\[Control\]/d
s/?/ /g
/^\s*$/d
s/:space:*$//
s/–/-/g
s/> </></g
G

Simple Python Folder in Ubuntu

Use a bridge server to allow access to a server on your home network.

Simple script to build and start Python server:
cd ~/Documents/bookingflow
grunt
cd ~/Documents/bookingflow/build
python -m SimpleHTTPServer

Sharing Ubuntu VirtualBox Folder with Windows

Refer #1: http://www.howtogeek.com/116309/use-ubuntus-public-folder-to-easily-share-files-between-computers/
Refer #2: https://help.ubuntu.com/community/Samba/SambaServerGuide

To start you need to right-click the folder to share and then install the software

Afterwards you'll need to change the settings to share the files:

sudo nano -w /etc/samba/smb.conf

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
read only = no

# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
create mask = 0775

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
directory mask = 0775

Sharing VirtualBox folders

You have Ubuntu running in Windows and you want to share a windows folder with Ubuntu. Do the following:

Make sure you have installed the Guest Additions

Configure the shared folder in my VirtualBox. Click menu option "Devices->Shared Folders" to configure the sharing

This has gotten much easier now, VirtualBox will just mount the folder; however, you need to make sure your user is part of the vboxsf group; otherwise, you will need to be root in order to copy or access the files, use the following command:

sudo usermod -G vboxsf -a jboss1

Older Instructions

Open terminal and created a directory called share under "mnt" so it looks as “/mnt/share”. This required "admin" privileges, and then run the following command.

sudo mount -t vboxsf sharename /mnt/share

There is a bug with VirtualBox 4.3.10 and mounting, the following commands will fix, after you mount the Guest Additions

$ cd /sbin
$ sudo rm mount.vboxsf
$ ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions/mount.vboxsfsudo usermod -G vboxsf -a jboss1

Mounting SSH Connection on Ubuntu

You need to install SSHFS, can happend in "Software Center"

To mount:
mkdir ~/haldevjbs13
sshfs -o idmap=user jboss1@haldevjbs13.hq.halw.com:/ ~/haldevjbs13
sshfs -o idmap=user $USER@haldevjbs13.hq.halw.com:/remote-folder-to-mount/ ~/haldevjbs13

To unmount:
fusermount -u ~/haldevjbs13

Getting Eclipse to work with Oracle Java 1.7

Refer: http://stackoverflow.com/questions/10165693/eclipse-cannot-load-swt-libraries

On my Ubuntu 12.04 32 bit. I edit the command to:
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86/

And on Ubuntu 12.04 64 bit try:
ln -s /usr/lib/jni/libswt-* ~/.swt/lib/linux/x86_64/

Not really what I wanted as a solution but important to note:

Because I had installed the Oracle Java 7 it had changed the default Java to Oracle Java 7, however it needed to be the Open JDK.

To fix, open up terminal and type

sudo update-alternatives --config java
This brings up a list of the different types of Java. Simply select the Open JDK.