This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import time | |
def start_program(program): | |
proc = subprocess.Popen([program], stdout=subprocess.PIPE) | |
return proc | |
def run(program, time_seconds): | |
while True: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import sys | |
def start_program(program): | |
proc = subprocess.Popen([program], stdout=subprocess.PIPE) | |
return proc | |
def monitor_program(proc, match): | |
for line in iter(proc.stdout.readline, ''): # replace '' with b'' for Python 3 | |
sys.stdout.write(line) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: Deployment | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: scalingredis-example | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
name: scalingredis-example-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
kind: Deployment | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: scalingredis-example | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
name: scalingredis-example-api |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { | |
redisResp := redisClient.Cmd("GET", "known-key") | |
if redisResp.Err != nil { | |
panic(err) | |
} | |
str, err := redisResp.Str() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// window = [index, length] same for minWin | |
S = A D O B E C O D E C B F A N E T S | |
window = [0,0] | |
minWin = [0,0] | |
minlen = 0 | |
S = [A] D O B E C O D E C B F A N E T S | |
window = [0,1] | |
minWin = [0,0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function factory(value) { | |
return function callback(error) { | |
// handle error | |
} | |
} | |
a.on("error", factory(value)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ping $PING_IP | perl -nle 'BEGIN {$|++} print scalar(localtime), " ", $_' > $PING_OUT & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vm = require('vm') | |
try { | |
vm.runInThisContext('var hello = "world"; console.log("Hello " + hello);'); | |
} catch(e) { | |
console.log('Failed unexpectedly') | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
import couchdb as couch | |
from uuid import uuid4 | |
# set up db connection / a localhost connection | |
server = couch.Server() | |
db = server["short_url"] | |
# set up flask app | |
app = Flask(__name__) |
NewerOlder