Tuesday, July 7, 2015

Mac OS X "Open"

I just love the OS X command 'open'.  No matter where you are you can just type open filename and it'll figure out the associated app and open the file with it.  I wished there was a Linux equivalent 'till go figure... there is one.

I found this stackoverflow post mentioning the command xdg-open.

that's a bit convoluted to write, so i made an alias

alias lopen='xdg-open'

lopen foobar.pdf
lopen .
lopen somefile.py

All of it works flawlessly.  :D I love it

PS. open command is taken by an openvt binary.  Hence lopen.

Hint:  To change the default association, in gnome at least:

Right-click->Properties->Open With->Set as default (lower right).

If you need to add a custom application. (I'll assume you created a .desktop icon and it shows up properly in your gnome menu using alacarte or by hand)

You need to update your:

 ~/.config/mimeapps.list

For example in my case, I added the following line:

text/plain=alacarte-made.desktop;

where alacarte-made.desktop is my sublime editor.

You can fine a list of most of the supported mimetypes in:

/usr/share/applications/defaults.list




Wednesday, April 8, 2015

Fixing Font Rendering In Chrome Fedora

Fonts in general aren't as pretty in Fedora out of the box as they are in Ubuntu.  But the Chrome rendering is horrible.  I had to add this little gem to my ~/.fonts.conf file.

<match target="font">
 <edit name="autohint" mode="assign">
    <bool>true</bool>
 </edit>
 <edit name="hinting" mode="assign">
    <bool>true</bool>
 </edit>
 <edit mode="assign" name="hintstyle">
    <const>hintslight</const>
 </edit>
</match>

Thursday, April 2, 2015

Ubuntu 15.04 Broken Upstart / Working Systemd

Ubuntu 15.04 I believe has switched over to upstart which in turn has broken more then a few 3rd party apps I had installed.

For example whenever I tried to install plex media server I would get the following error:

"initctl: Unable to connect to Upstart: Failed to connect to socket /com/ubuntu/upstart: Connection refused"


Here's the fix that worked for me:

sudo dpkg-divert --local --rename --add /sbin/initctl
ln -s /bin/true /sbin/initctl

Credit for this little tweak: https://www.nesono.com/?q=node/368


Sunday, June 1, 2014

Raid 5 to ZFS (Part 3 )

I posted a few articles in the past on migrating from Raid 1 to Raid 5. This will be my attempt to migrate from a raid 5 system to ZFS.

Setup

sudo apt-add-repository --yes ppa:zfs-native/stable
sudo apt-get update
sudo apt-get install ubuntu-zfs
Validate that the module was load.
sudo modprobe zfs
sudo dmesg | grep ZFS
Expected output should be something along these lines:
[  824.725076] ZFS: Loaded module v0.6.1-rc14, ZFS pool version 5000, ZFS filesystem version 5
This should get you all you need to create a standard ZFS setup. If you're starting from a clean slate, follow this guide. I'll follow it as a guide, though my plan is to shift from Raid 5 to ZFS. (Naturally backup, backup, backup....oh and did I mention backup? Okay good).

Thursday, March 13, 2014

Mesos on Ubuntu 13.10 Part 1

This is my experiment to get mesos setup on Ubuntu.  Think of mesos as an layer running on top of your native OS that manages the machine's resources.  You can then request and allocate resources as needed.  This is just a blog post where I went through the steps and got master setup to run on an Ubuntu Server.

Install instructions come from:  http://mesos.apache.org/gettingstarted/

Install Dependencies.


sudo apt-get update
sudo apt-get install build-essential openjdk-7-jdk python-dev python-boto libcurl4-nss-dev libsasl2-dev autoconf libtool 

Build Mesos

    # Change working directory.
    $ cd mesos

    # Bootstrap (***Skip this if you are not building from git repo***).
    $ ./bootstrap

    # Configure and build.
    $ mkdir build
    $ cd build
    $ ../configure
    $ make -j

    # Run test suite.
    $ make -j check

    # Install (***Optional***).
    $ make install

Examples

 
# Change into build directory.
 $ cd build

 # Start mesos master.
 $ ./bin/mesos-master.sh --ip=127.0.0.1

 # Start mesos slave.
 $ ./bin/mesos-slave.sh --master=127.0.0.1:5050

 # Visit the mesos web page.
 $ http://127.0.0.1:5050

 # Run C++ framework (***Exits after successfully running some tasks.***).
 $ ./src/test-framework --master=127.0.0.1:5050

 # Run Java framework (***Exits after successfully running some tasks.***).
 $ ./src/examples/java/test-framework 127.0.0.1:5050

 # Run Python framework (***Exits after successfully running some tasks.***).
 $ ./src/examples/python/test-framework 127.0.0.1:5050

Sunday, March 17, 2013

Cloud Security Encryption

I've started using Google Drive under Linux with the automatic sync being provided by InSync.  One of my concerns, like most people is security.  Like with any security system, the more security it is the less convenient it is.  You gain more security by sacrificing more conveniences.

ie.  The most secure storage, is a turned off computer put in a safe.  (it's secure and utterly useless).

My first approach is a bit less secure, but fairly convenient.

1.  InSync basically lets me sync files to supposedly multiple Google Drive accounts, though I still have to figure out the exact procedure for that.  For now, I drop a file in $HOME/Insync/account_name/ and it magically appears in my google drive.  Some files, say bills, and tax records I might not want to put on my google drive.

Approach A


I decided to keep all my files as pdfs.  So, all I need to do is figure out a way to encrypt them.  I decided to use pdftk which is pretty much the best tool kit I've found for manipulating PDFs.

Here my steps:
1.  Scan / place file into a non-cloud enabled location.  Let's call this $HOME/tmp/ and call the file open.pdf
2.  Encrypt the file.

     pdftk $HOME/tmp/open.pdf output encrypted.pdf owner_pw s3cr3t
     naturally, replace s3c3t with your own password.
3.  move file to your synchronized 'folder' where it will be kept.

Advantages:
  • Qausi secure.  128bit encryption on pdf files.
  • Google understands encrypted files, and will prompt you for your password when trying to open your pdfs.  Which means, you can open and view your secure files via any web browser.
Disadvantages:
  • 128Bit encryption is inconvenient to break, but not impossible.  If you're storing important information.. like say your tax records with your SSN, you probably want something more secure.

Approach B

This approach was intended to take advantage of boxcryptor.  I was following an old guide for this service to allow for linux support, though right now, I really can't see a reason to use them, since as far as I can tell, a native Dropbox/ Google Plus client + encfs will provided essentially the same benefits.

Directions:

1.  We'll be relying on encfs.  I think cryptkeeper is supposed to be a nicer more user friendly way of doing this, but I could figure out how to use it, or cared enough to look into it, so we'll be doing this the CLI way.

sudo apt-get install encfs
sudo apt-get install cryptkeeper #optionally 

2.  we'll call your sync folder "cloud", replace this with ~/Dropbox, ~/insync/username/ or whatever is appropriate in your case.

cd ~/cloud
mkdir ~/temp_cloud
mv ~/cloud/* ~/temp_cloud  # moving all files out of cloud storage

3.  This will probably delete all your 'cloud' storage, but that's okay.  We just moved the files out into a local folder.  If you're doing this with gigs and gigs of data...this might take a while.

4.  Mount your ~/cloud as an encrypted folder

encfs ~/cloud ~/secure_storage  #I just used p for default settings and entered a nice long password.
mv ~/temp_cloud/* ~/secure_storage/

5.  Enabling automatic mounting of ~/cloud 

sudo apt-get install  libpam-mount
sudo gpasswd -a USERNAME fuse
sudo vim /etc/security/pam_mount.conf.xml
insert a line resembeling this one right below:

<!-- Volume definitions -->
        <volume user="user" fstype="fuse" path="encfs#/home/user/secure_storage" mountpoint="/home/user/cloud" />

6.  Reboot, and your drive should be automatically mounted.  Now IF you want to ensure that the file is encrypted then you should only be working in the folder ~/secure_storage.  Any files you create in ~/cloud directly will be plaintext and in-secure.

Advantages:
  • Much higher lever of security then anything a PDF crypto will provide.
  • Pretty much transparent.  You could also configure your cloud app to look at ~/crypto and mount ~/Dropbox (for example).  essentially switching the order.  
Disadvantages:
  • All the files are utter garbage via a web browser.
  • Main big issue I have right now, is there seem to be a file name limit.  You can't have a file name longer then 36 characters.  


References

  1. http://pragmattica.wordpress.com/2009/05/10/encrypting-your-dropbox-seamlessly-and-automatically/   (Prettier version of Approach B I found while looking up stuff as I was writing this document) 

Wednesday, December 19, 2012

Social Media History Clean Up

I'm not sure if anyone would find this useful, but made a very green alpha release of a pet project I had for a while.


I was getting annoyed with twitter and other social media when I wrote this.  I mainly wrote a social media finger print cleanup.  It asks for permission and will flush out your entire twitter minus two weeks delay.  

So if I ran this today, 12/19/2012, then any post I made that was on or before 12/04/2012 would be deleted. 

I know it needs to be a lot more configurable .and I have several todo items associated with this project.  I'm just curious to know if anyone would find it useful.