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
nginx-full nginx-extras nginx-light | |
Access YES YES YES | |
Addition File AIO Mail Core - YES - | |
Addition Mail Core YES - - | |
Auth Basic YES YES YES | |
Auto Index YES YES YES | |
Browser YES YES - | |
Charset YES YES YES | |
Echo YES YES - | |
Embedded Lua - YES - |
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
#!/bin/sh | |
# Hopefully fixes the infamous "Spotify crashes immediately on startup" bug. | |
# In fact, it does not crash immediately; it seems to be crashing while | |
# looking for local files. The first time you start Spotify after the boot | |
# of your machine, you will have maybe 10 seconds before it crashes. Then, | |
# after each start, it will crash almost instantly (less than one second on | |
# my box). | |
# | |
# The following workaround replaces one of Spotify's configuration files | |
# with a FIFO, effectively preventing reading from the file. Then, it writes |
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
HTTPUSER = 'mylogin' | |
HTTPPASS = 'mypassword' | |
from wsgiproxy.app import WSGIProxyApp | |
from base64 import encodestring | |
proxyapp = WSGIProxyApp('http://remote.server.domain.com/') | |
# Craft Basic Auth header. Don't forget to strip the trailing \n. | |
HTTPAUTH = 'Basic ' + encodestring(HTTPUSER+':'+HTTPPASS).strip() |
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
Edit your dotcloud.yml file to add the "ports" section as shown in the sample dotcloud.yml. | |
Add a supervisord.conf to start the socat program. | |
Push your code. Use "dotcloud info" to retrieve the host+port to be used for your admin connection (it's conveniently named "admin" since it's what we requested in dotcloud.yml). Enjoy! | |
Note: this won't work with the custom service, but can be easily adapted if needed. |
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
# Find all minutes during which there was at least one "502" status code: | |
grep ' 502 ' http.log | awk '{print $4}' | cut -d: -f1-3 | uniq | |
# Find all minutes during which there were valid requests (excluding 502 and 400 status codes): | |
grep -v ' 502 ' http.log | grep -v ' 400 ' | awk '{print $4}' | cut -d: -f1-3 | uniq | |
# If you want hours instead of minutes, replace f1-3 by f1-2. |
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
#!/bin/bash | |
[ -d ~/bin ] || virtualenv ~ | |
. ~/bin/activate | |
cp -a . ~ | |
cd | |
python bootstrap.py | |
sed -i 's/port = 8080/port = 42800/g' base.cfg # ugly hack | |
buildout |
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
#!/usr/bin/env python | |
import commands, sys, os | |
padump = commands.getoutput('pacmd dump').split('\n') | |
if sys.argv[1]=='toggle': | |
for muteline in padump: | |
if 'set-sink-mute' in muteline: | |
cmd, src, val = muteline.split() | |
val = {'yes':'no', 'no':'yes'}[val] | |
os.system('pacmd {cmd} {src} {val} >/dev/null'.format(**locals())) | |
else: |
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
#!/bin/sh | |
rrdtool create foo.rrd --start -2h --step 900 DS:foo:GAUGE:3600:0:100 RRA:AVERAGE:0.5:1:1000 | |
for N in $(seq 20 -1 1) | |
do | |
rrdtool update foo.rrd -- -$(($N*600)):$N$N | |
rrdtool lastupdate foo.rrd | |
done | |
rrdtool graph --start -1h foo.png DEF:foo=foo.rrd:foo:AVERAGE LINE:foo#000000:thefoo | |
rrdtool fetch foo.rrd AVERAGE | tail |
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
Use this like the "ruby" service: it will install dependencies from Gemfile, and look for a Rails/Rack environment to serve it with passenger. | |
However, it will also run: | |
- a local memcached, on port 11211 | |
- a local jetty configured to deploy WAR files, with servlets & JSP support, on port 8080 | |
Place WAR files in the webapps directory as in this example. | |
If you need to add worker processes, add them to dotcloud.yml, in the processes section. |
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
#!/usr/bin/env python | |
A = [1, 8, -3, 0, 1, 3, -2, 4, 5] | |
def complementary_pairs(K, A): | |
buckets = {} | |
for x in A: | |
if x not in buckets: | |
buckets[x] = 0 | |
buckets[x] += 1 |
OlderNewer