- using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
- using inventory:
127.0.0.1 ansible_connection=local
#!/usr/bin/env python | |
''' | |
Simple and functional REST server for Python (3.5) using no dependencies beyond the Python standard library. | |
Ported from original lib for Python 2.7 by Liron (tliron @ github.com) https://gist.github.com/tliron/8e9757180506f25e46d9 | |
Features: | |
* Map URI patterns using regular expressions | |
* Map any/all the HTTP VERBS (GET, PUT, DELETE, POST) | |
* All responses and payloads are converted to/from JSON for you | |
* Easily serve static files: a URI can be mapped to a file, in which case just GET is supported |
import numpy as np | |
import matplotlib.pyplot as plt | |
modulator_frequency = 4.0 | |
carrier_frequency = 40.0 | |
modulation_index = 1.0 | |
time = np.arange(44100.0) / 44100.0 | |
modulator = np.sin(2.0 * np.pi * modulator_frequency * time) * modulation_index | |
carrier = np.sin(2.0 * np.pi * carrier_frequency * time) |
/* | |
* Recursively list directories/files through Java, akin to Linux's `ls -R` command. | |
* (c) 2017, KazWolfe. Under MIT license. | |
* | |
* To use, save to `Recurse.java` and compile with `javac Recurse.java`. | |
* Run with `java -cp . Recurse /path/to/operate/on`. Be sure you are passing in a folder. | |
*/ | |
import java.io.File; | |
import java.lang.String; |
// Inspired by the joke: | |
// "A programmer was walking out the door for work when | |
// his wife said, 'While you're out, buy some milk.' | |
// The programmer never came home. | |
programmer.getToDoList().getLocationList().addItem(Location.ANYWHERE, () -> {programmer.moveTo(Location.SUPERMARKET);}); | |
programmer.getToDoList().getLocationList().addItem(Location.SUPERMARKET, (neededAmount) -> { | |
// Get the price and inventory from the Economy. | |
double price = Economy.getStore(Store.SUPERMARKET).getInventory().getItemClass(ItemClass.MILK).getPrice(); |
ansible-playbook --connection=local 127.0.0.1 playbook.yml
127.0.0.1 ansible_connection=local
import sys,os | |
import curses | |
def draw_menu(stdscr): | |
k = 0 | |
cursor_x = 0 | |
cursor_y = 0 | |
# Clear and refresh the screen for a blank canvas | |
stdscr.clear() |
I have been using some flavor of GNU/Linux (which excludes Android) since about 2002. The first distro I ever installed was Lindows, and while I often used Lindows as my "main" distro because it was so easy to use, I was very much a distro shopper in my early years. I'd find a spare USB hard drive or flash drive and throw Gentoo or Debian or openSUSE or Fedora on it. It wasn't until the release of Ubuntu 8.04, Hardy Heron, that I finally settled on a "preferred" distro: Ubuntu. And, unlike its commercial open source relative, Linspire, Ubuntu didn't run out of money and stop development. So that was a big plus.
Also unlike its other more distant relative, Fedora, Ubuntu had a more predictable release schedule, and longer support for each release. This meant I could feel free to use a crusty old installation on a dedicated server and be confident that I'd continue to receive critical security updates for years to come. And that's exactly what I did: starting around 2006, I have had either a dedicated
#!/usr/bin/env python | |
''' | |
Simple and functional REST server for Python (2.7) using no dependencies beyond the Python standard library. | |
Features: | |
* Map URI patterns using regular expressions | |
* Map any/all the HTTP VERBS (GET, PUT, DELETE, POST) | |
* All responses and payloads are converted to/from JSON for you |
#!/usr/bin/env python2 | |
import appindicator | |
import gtk | |
import urllib2 | |
class IPIndicator(appindicator.Indicator): | |
""" | |
An indicator displaying public IP address. |
import random | |
def coroutine(func): | |
"""A decorator to automatically prime coroutines""" | |
def start(*args, **kwargs): | |
cr = func(*args, **kwargs) | |
next(cr) | |
return cr | |
return start |