NOW MAINTAINED IN MY DOTFILES GITHUB REPO: http://git.io/zuH1MQ
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
class User(db.Model): | |
location = db.StringProperty() | |
timezone = db.StringProperty(default='America/Los_Angeles') | |
# Do this once per user | |
def calculate_timezone(self): | |
from simplegeo import Client | |
client = Client('oauth key', 'oauth secret SHH') | |
response = client.context.get_context_by_address(self.location) | |
for feature in response['features']: |
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
# display red exit value if it isn't zero | |
PROMPT_COMMAND='EXITVAL=$?; '$PROMPT_COMMAND | |
GET_EXITVAL='$(if [[ $EXITVAL != 0 ]]; then echo -n "\[\e[37;41;01m\] $EXITVAL \[\e[0m\] "; fi)' | |
export PS1="$GET_EXITVAL$PS1" |
#####EDIT: NB Ban is technically different from Purge. Banned objects remain in memory but banning is faster than purging. Read the Varnish 3 documentation here and here.
Purge may be a more appropriate action for your use-case; although the examples in the gist below work, it's not necessarily the best way of doing this.
##The Good, The Bad, & The Ugly Ways of handling Async Operations With Javascript## #####Callbacks < Promises < Generators#####
###An Example: 5 in-sequence Async Operations### (also see parallel-sequence example: https://gist.github.com/willrstern/af3a3308fc5864cf48f8)
###The Ugly Way: Callbacks### After each function takes place, handle any errors & do the next thing - It's easy to walk through the code and understand what's going on...but it's ugly as sin
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 ubuntu:14.04 | |
ENV DEBIAN_FRONTEND noninteractive | |
ENV HOME /root | |
RUN apt-get -qq -y update | |
RUN apt-get -qq -y install software-properties-common | |
RUN apt-add-repository -y ppa:ansible/ansible | |
RUN apt-get -qq -y update | |
RUN apt-get -qq -y install ansible |
###The Issue With Forever Forever is great for running node services, with a minor setback: the word "forever" doesn't apply to system reboots.
###The solution, run node apps as a system service logged in as root
vim /etc/init/node-app.conf
Contents for node-app.conf
- Note that SHA2 hash algorithm may be not supported on older systems (Windows XP, Windows 2003, among others).
- Be aware that mandatory https on SNI vhosts eliminate [Internet Explorer on Windows XP, among others] (http://en.wikipedia.org/wiki/Server_Name_Indication#Web_browsers.5B6.5D).
- My version of konklones SSL config does not have SPDY support(my nginx+openssl does not support it)
- You need a default ssl server (example.org-default.conf).
- Some SSL-options have to be unique across your instance, so it's easier to have them in a common file(ssl.conf).