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 request | |
from flask import Flask, request, redirect | |
BASE_URL = os.environ.get('BASE_URL') or 'http://localhost:5000' | |
VAULT_ADDR = os.environ['VAULT_ADDR'] | |
VAULT_ROLE = os.environ['VAULT_ROLE'] | |
GOOGLE_CLIENT_ID = os.environ['GOOGLE_CLIENT_ID'] | |
GOOGLE_CLIENT_SECRET = os.environ['GOOGLE_CLIENT_SECRET'] | |
app = Flask(__name__) |
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 ruby | |
require 'logger' | |
require 'resque/server' | |
use Rack::ShowExceptions | |
Resque.redis = Redis.new(:host => "HOST", :port => 6379, :password => "PASS") | |
run Rack::URLMap.new \ |
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
<?php | |
if (file_exists($_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'])) return false; | |
else include($_SERVER['DOCUMENT_ROOT'].'/index.php'); |
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
# coding: utf-8 | |
import profile | |
#from memory_profiler import profile as mprofile | |
from random import random | |
from itertools import chain | |
data = [[random() for j in xrange(1000)] for i in xrange(1000)] | |
def add(x,y): |
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
server { | |
listen 80; | |
server_name host.example.com; | |
charset utf-8; | |
access_log /var/log/nginx/host.example.access.log main; | |
error_log /var/log/nginx/host.example.error.log; | |
index index.php; |
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
# save config/unicorn.rb | |
worker_processes 2 | |
working_directory "/home/{project_name}/app" | |
listen '/home/{project_name}/tmp/unicorn.sock' | |
stderr_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT']) | |
stdout_path File.expand_path('log/unicorn.log', ENV['RAILS_ROOT']) | |
preload_app 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
#!/bin/sh | |
BASE=$HOME/app | |
UNICORN_PID=$BASE/tmp/pids/unicorn.pid | |
case "$1" in | |
reload) | |
echo "reload..." | |
if [ ! -r $UNICORN_PID ] ; then | |
echo "no pid file found. maybe is no running." |
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 | |
# | |
# run as current user | |
# > mkdir ~/.phpenv/init | |
# > vim 5.3.19 | |
# | |
# before, you should edit php-fpm.conf | |
# and comment out [www] user and group. | |
PHP_BASE=$HOME/.phpenv/versions/{version} |
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
""" | |
This is a simple example of WebSocket + Tornado + Redis Pub/Sub usage. | |
Do not forget to replace YOURSERVER by the correct value. | |
Keep in mind that you need the *very latest* version of your web browser. | |
You also need to add Jacob Kristhammar's websocket implementation to Tornado: | |
Grab it here: | |
http://gist.github.com/526746 | |
Or clone my fork of Tornado with websocket included: | |
http://github.com/pelletier/tornado | |
Oh and the Pub/Sub protocol is only available in Redis 2.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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta lang="ja" /> | |
<meta charset="utf-8" /> | |
<meta name="apple-mobile-web-app-capable" content="yes" /> | |
<meta name="viewport" content="width=device-width; height=device-height; initial-scale=1.0; maximum-scale=1.0; user-scalable=no"> | |
<!--touch icon--> | |
<link rel="apple-touch-icon-precomposed" size="114x114" href="img/apple-touch-icon-114x114.png" /> | |
<link rel="apple-touch-icon-precomposed" size="72x72" href="img/apple-touch-icon-72x72.png" /> |
NewerOlder