(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| (defn sha1-str [s] | |
| (->> (-> "sha1" | |
| java.security.MessageDigest/getInstance | |
| (.digest (.getBytes s))) | |
| (map #(.substring | |
| (Integer/toString | |
| (+ (bit-and % 0xff) 0x100) 16) 1)) | |
| (apply str))) |
| ###################### | |
| ## shadowsocks-libev | |
| ###################### | |
| # install dependencies | |
| yum install epel-release -y | |
| yum install gcc gettext autoconf libtool automake make pcre-devel asciidoc xmlto udns-devel libev-devel -y | |
| # install shadowsocks-libev | |
| cd /etc/yum.repos.d/ |
| (ns x.y | |
| (:use [plumbing.core]) ;; Just for the map-vals | |
| (:require [clojure.walk :refer [postwalk prewalk prewalk-demo postwalk-demo]] | |
| [clojure.core.match :refer [match]] | |
| [schema.utils :refer [named-error-explain validation-error-explain]] | |
| [schema.core :as s]) | |
| (:import (schema.utils NamedError ValidationError))) | |
| ;; Partially FROM: | |
| ;; https://github.com/puppetlabs/clj-schema-tools |
| #!/usr/bin/env python | |
| # Reflects the requests from HTTP methods GET, POST, PUT, and DELETE | |
| # Written by Nathan Hamiel (2010) | |
| from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler | |
| from optparse import OptionParser | |
| class RequestHandler(BaseHTTPRequestHandler): | |
| def do_GET(self): |
| # These examples assume you have a container currently running. | |
| # 1 Pipe from a file | |
| sudo docker exec --interactive CONTAINER_NAME /bin/bash < the_beginning.sh | tee the_beginning_output.txt` | |
| #2a Pipe by piping | |
| echo "echo This is how we pipe to docker exec" | sudo docker exec --interactive CONTAINER_NAME /bin/bash - |
| #!/bin/bash | |
| readonly DB_FILE="$(pwd)/images.db" | |
| readonly IMG_DIR="$(pwd)/images" | |
| save-images() { | |
| echo "Create ${DB_FILE}" | |
| echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}" | |
| echo "Read ${DB_FILE}" |
| #! /bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: supervisord | |
| # Required-Start: $remote_fs | |
| # Required-Stop: $remote_fs | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Example initscript | |
| # Description: This file should be used to construct scripts to be | |
| # placed in /etc/init.d. |