Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
#! /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. |
application: you-app-name-here | |
version: 1 | |
runtime: python | |
api_version: 1 | |
default_expiration: "30d" | |
handlers: | |
- url: /(.*\.(appcache|manifest)) | |
mime_type: text/cache-manifest |
description "supervisord" | |
start on runlevel [2345] | |
stop on runlevel [!2345] | |
respawn | |
exec /usr/local/bin/supervisord --nodaemon --configuration /etc/supervisord.conf |
# On CodeEval, test cases are read in from a file which is the first argument to your program | |
# Open the file and read in line by line. Each line represents a different test case | |
# (unless given different instructions in the challenge description) | |
import sys | |
test_cases = open(sys.argv[1], 'r') | |
for test in test_cases: | |
# ignore test if it is an empty line |
#!/bin/bash | |
# | |
# Install Postgres 9.1, PostGIS and create PostGIS template on a clean Ubuntu 11.10 Oneiric Ocelot box | |
# http://wildfish.com | |
# add the ubuntu gis ppa | |
sudo apt-get -y install python-software-properties | |
sudo add-apt-repository ppa:ubuntugis/ubuntugis-unstable | |
sudo apt-get update |
Get Homebrew installed on your mac if you don't already have it
Install highlight. "brew install highlight". (This brings down Lua and Boost as well)
brew install git bash-completion
Configure things:
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
import sys, os, re | |
info = {"folder": sys.argv[1], "extensions": sys.argv[2].split(","), "statements": dict.fromkeys(["if", "for", "while", "do", "switch", "case"], 0), "lines": 0} | |
for dirpath, dirnames, filenames in os.walk(info["folder"]): | |
for filelines in [open(os.path.join(dirpath, fname)).readlines() for fname in filenames if fname.split(".")[-1] in info["extensions"]]: | |
for line in filelines: | |
info["lines"] += 1 | |
found = re.search(r"^\s*(%s)\b" % "|".join(info["statements"].keys()), line) | |
if found != None: info["statements"][found.group(1)] += 1 | |
print "O seu codigo possui:\n %d linhas\n" % info["lines"] + "\n".join(" %s: %d" % (k, v) for k, v in info["statements"].iteritems()) |
-- show running queries (pre 9.2) | |
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(clock_timestamp(), query_start), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
eXtreme Go Horse (XGH) Process | |
Quelle: http://gohorseprocess.wordpress.com | |
Übersetzung ursprünglich von https://gist.github.com/Neffez/f8d907ba8289f14e23f3855011fa4e2f | |
1. Ich denke, also ist es nicht XGH. | |
In XGH wird nicht gedacht, es wird das erste gemacht, was in den Sinn kommt. Es gibt auch keine zweite Option, die erste ist schneller. | |
2. Es gibt 3 Wege ein Problem zu lösen: den richtigen Weg, den falschen Weg und den XGH Weg, welcher exakt wie der falsche ist, aber schneller. |