Tag Archive for 'python'

Search Helper with Vivaldi

I just updated Search Helper with a Vivaldi browser selection.  It works on Gnome 3.

Search Helper Updated

Application update includes Ecosia in place of Qrobe, and the addition of Program Creek.
Osmhic Search Helper: https://github.com/robertdknight/Osmhic-Search-Helper-GTK3

Data science work station

As of October 2017, these installations on Cent OS 7 create a functional data science workstation.

  1. yum install epel-release
  2. yum install ImageMagick
  3. yum install python-pip
  4. yum install python-devel
  5. yum install tkinter
  6. yum groupinstall “Development Tools”
  7. yum install R
  8. pip install –user parsedatetime
  9. pip install –user matplotlib
  10. pip install –user cython
  11. pip install –user scipy
  12. pip install –user xlsxwriter
  13. pip install –user pystan
  14. pip install –user fbprophet
  15. from R prompt of the user who uses R: install.packages(‘prophet’)

SHA1 Hash in Right Click Menu

Minecraft’s server.properties file has a field for sha1 hash for resource packs. To use this, install nautilus-python and then copy this python script using any file name (such as sha1_hash.py) into ~/.local/share/nautilus-python/extensions.  This provides a SHA-1 hash on the right click menu.

# Robert Knight, 

from gi.repository import Nautilus, GObject
import hashlib
import urllib

class Sha1Menu(GObject.GObject, Nautilus.MenuProvider):
    """ This places a SHA-1 sum in the context menu in Nautilus.
    To use it, nautilus-python is required.  This script then goes in
    ~/.local/share/nautilus-python/extensions and should work after a 
    restart of Nautilus
    """
    def __init__(self):
        pass

    def menu_activate_cb(self, menu, file):
        print "menu_activate_cb",file

    def get_file_items(self, window, files):
        if len(files) != 1:
            return

        file = files[0]
        filename = urllib.unquote(file.get_uri()[7:])
        sha1sum = hashlib.sha1()
        with open(filename,'rb') as f:
            for chunk in iter(lambda: f.read(8192), ''):
                sha1sum.update(chunk)
        f.close()
        string = sha1sum.hexdigest()
        item = Nautilus.MenuItem(name="Sha1Menu::Show_File_Name",
                                 label="SHA-1: %s" % string,
                                 tip="SHA-1: %s" % string)
        item.connect('activate', self.menu_activate_cb, file)
        
        return [item]

SHA-1 is not the most secure, but is the version used in the Minecraft server for resource pack hashing.