-
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
- Delete all untagged images
# Simple version for Python 2.7+ | |
my_ordered_dict = json.loads(json_str, object_pairs_hook=collections.OrderedDict) | |
# Or for Python 2.4 to 2.6 | |
import ordereddict | |
my_ordered_dict = json.loads(json_str, object_pairs_hook=ordereddict.OrderedDict) |
ActiveSupport::Inflector.inflections do |inflect| | |
inflect.plural /([aeiou])([A-Z]|_|$)/, '\1s\2' | |
inflect.plural /([rlnd])([A-Z]|_|$)/, '\1es\2' | |
inflect.plural /([aeiou])([A-Z]|_|$)([a-z]+)([rlnd])($)/, '\1s\2\3\4es\5' | |
inflect.plural /([rlnd])([A-Z]|_|$)([a-z]+)([aeiou])($)/, '\1es\2\3\4s\5' | |
inflect.singular /([aeiou])s([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([rlnd])es([A-Z]|_|$)/, '\1\2' | |
inflect.singular /([aeiou])s([A-Z]|_)([a-z]+)([rlnd])es($)/, '\1\2\3\4\5' | |
inflect.singular /([rlnd])es([A-Z]|_)([a-z]+)([aeiou])s($)/, '\1\2\3\4\5' |
import websocket | |
import json | |
import logging | |
import datetime | |
api_key = 'Put your API Key here' | |
url = 'wss://stream.pushbullet.com/websocket/' + api_key | |
logging.basicConfig(filename='pushbullet.log', level=logging.INFO, | |
format='%(asctime)s:%(levelname)s:%(message)s', datefmt='%m/%d/%Y %I:%M:%S %p') |
require 'faye/websocket' | |
require 'eventmachine' | |
require 'json' | |
require 'logger' | |
api_key = 'Put your API Key here' | |
url = 'wss://stream.pushbullet.com/websocket/' + api_key | |
logger = Logger.new('pushbullet.log') | |
logger.level = Logger::INFO |
# download latest libevent2 and tmux sources, and extract them somewhere | |
# | |
# at the time of writing: | |
# https://github.com/downloads/libevent/libevent/libevent-2.0.21-stable.tar.gz | |
# http://sourceforge.net/projects/tmux/files/latest/download?source=files | |
# | |
# don't compile tools as root, just don't do it. | |
# install deps |
import urllib2 | |
import logging | |
from time import sleep | |
# how minutes wait between checks | |
time_between_check = 5 | |
# setup log output | |
logging.basicConfig(filename='publicIP.log', | |
level=logging.DEBUG, |
Delete all containers
$ docker ps -q -a | xargs docker rm
-q prints only the container IDs -a prints all containers
Notice that it uses xargs to issue a remove container command for each container ID
max_password_lenght = 8 | |
characters = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten | |
password = (0...max_password_lenght).map { characters[rand(characters.length)] }.join | |
puts password |
r := mux.NewRouter() | |
// Single handler | |
r.HandleFunc("/form", use(http.HandlerFunc(formHandler), csrf, logging) | |
// All handlers | |
http.Handle("/", recovery(r)) | |
// Sub-routers | |
apiMiddleware := []func(http.Handler) http.Handler{logging, apiAuth, json} |
import subprocess | |
from snimpy.manager import Manager as M | |
from snimpy.manager import load | |
import paramiko | |
import MySQLdb | |
import socket | |
USER = 'zenossmon' | |
KEY_FILE = '/home/efren/.ssh/id_rsa.pub' |