Install SleepWatcher using Homebrew:
sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher
Start the SleepWatcher service:
| #!/bin/bash | |
| # | |
| # Script to Install | |
| # Oracle Java 1.8 | |
| # Scala 2.11.7 | |
| # sbt 0.13.9 | |
| # | |
| ############################## | |
| #Script must be run as root/sudo |
| # For a local environment | |
| # Install hadoop and apache-spark via homebrew | |
| # Apache Spark conf file | |
| # libexec/conf/spark-defaults.conf | |
| # Make the AWS jars available to Spark | |
| spark.executor.extraClassPath /usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/aws-java-sdk-1.7.4.jar:/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/hadoop-aws-2.7.1.jar | |
| spark.driver.extraClassPath /usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/aws-java-sdk-1.7.4.jar:/usr/local/Cellar/hadoop/2.7.1/libexec/share/hadoop/tools/lib/hadoop-aws-2.7.1.jar | |
| # Add file |
| Install pip packages with homebrew: | |
| 1. Install Homebrew | |
| http://mxcl.github.com/homebrew/ | |
| 2. Install the brew-pip package | |
| brew install brew-pip | |
| 3. Add Homebrew's pip path to your PYTHONPATH environment variable (you probably should add this to some sort of shell initialization file like ~/.bashrc or ~/.zshrc) | |
| export PYTHONPATH=$(brew --prefix)/lib/python2.7/site-packages | |
| 3. Now install any pip pacakges with Homebrew! | |
| brew pip Glances |
| function fish_greeting | |
| if not which fortune > /dev/null ^ /dev/null | |
| switch (uname) | |
| case Darwin | |
| echo Installing fortune and cowsay | |
| brew install fortune | |
| sudo gem install lolcat | |
| case Linux | |
| echo Installing fortune and cowsay | |
| if which apt-get > /dev/null ^ /dev/null |
Install SleepWatcher using Homebrew:
sudo chown -R $(whoami) /usr/local
brew update
brew install sleepwatcher
Start the SleepWatcher service:
| #!/bin/sh | |
| # default commands for osx to make it nicer to work with | |
| ########################## | |
| # General UI?UX settings # | |
| ########################## | |
| # Set hostname (hex of MVB9APPS) | |
| sudo scutil --set ComputerName "0x4d56423941505053" | |
| sudo scutil --set HostName "0x4d56423941505053" |
| #!/bin/bash | |
| # Tom Hale, 2016. MIT Licence. | |
| # Print out 256 colours, with each number printed in its corresponding colour | |
| # See http://askubuntu.com/questions/821157/print-a-256-color-test-pattern-in-the-terminal/821163#821163 | |
| set -eu # Fail on errors or undeclared variables | |
| printable_colours=256 |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "time" | |
| ) | |
| // Fake a long and difficult work. | |
| func DoWork() { |
| There are many already existing powerful http servers that can be used in python e.g. gevent, twisted web server. However, they are a bit complex to use and you cannot start them in a thread other than the main thread. | |
| Here is a sample of basic http server using "BaseHTTPRequestHandler". The example exposed two rest interfaces: | |
| To ingest records into the web server | |
| To retrieve already ingested records from the web server | |
| The records are assumed to be JSON based, however, any type of records can be ingested. | |
| [sourcecode language="python" wraplines="false" collapse="false"] | |
| from BaseHTTPServer import BaseHTTPRequestHandler,HTTPServer |
This gist shows and example or an asynchronous multiprocess task broker which can take job requests and report on running jobs via a minimal REST API.
Adapted from https://gist.github.com/nitaku/10d0662536f37a087e1b
All of the caveats from the original author still apply.