This file contains hidden or 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
def init_nmp(): | |
install_nginx() | |
install_php() | |
install_phpfpm() | |
def install_nginx(): | |
sudo("add-apt-repository ppa:nginx/stable") | |
sudo("apt-get update") | |
sudo("apt-get -y -q install nginx-full nginx-common") |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" | |
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>Label</key> | |
<string>org.mongodb.mongod</string> | |
<key>ProgramArguments</key> | |
<array> | |
<string>/opt/local/bin/mongod</string> |
This file contains hidden or 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
# It's not possible to have a "KEYS *" command in memcached directly | |
# but could achieve by two steps | |
➜ ~ telnet 127.0.0.1 11211 | |
Trying 127.0.0.1... | |
Connected to localhost. | |
Escape character is '^]'. | |
set one 0 60 1 | |
1 | |
STORED |
This file contains hidden or 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
Show hidden characters
{ | |
"color_scheme": "Packages/Color Scheme - Default/Solarized (Dark).tmTheme", | |
"font_size": 15.0, | |
"draw_white_space": "selection", | |
"trim_trailing_white_space_on_save": true, | |
"tab_size": 2, | |
"translate_tabs_to_spaces": true, | |
"tab_completion": true, | |
"save_on_focus_lost": true, | |
"highlight_line": true |
This file contains hidden or 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> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0-rc.3/handlebars.js"></script> | |
<script src="http://cdnjs.cloudflare.com/ajax/libs/ember.js/1.0.0-rc.6/ember.min.js"></script> | |
<link href="http://getbootstrap.com/dist/css/bootstrap.css" rel="stylesheet" type="text/css" /> | |
<script src="http://getbootstrap.com/dist/js/bootstrap.js"></script> | |
<meta charset=utf-8 /> | |
<title>JS Bin</title> |
This file contains hidden or 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
# Ubuntu upstart file at /etc/init/mongodb.conf | |
limit nofile 32768 32768 | |
kill timeout 300 # wait 300s between SIGTERM and SIGKILL. | |
pre-start script | |
mkdir -p /data/mongodb &> /dev/null | |
mkdir -p /data/logs/mongo &> /dev/null | |
chown mongodb:nogroup /data/mongodb &> /dev/null |
This file contains hidden or 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
# `pip install shortuuid` | |
import uuid | |
long = uuid.uuid5(namespace=uuid.NAMESPACE_URL, name="http://example.com") | |
print long # UUID('8c9ddcb0-8084-5a7f-a988-1095ab18b5df') | |
import shortuuid | |
short = shortuuid.uuid(name="http://example.com") | |
print short # 'c8sh5y9hdSMS6zVnrvf53T' |
This file contains hidden or 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
""" | |
Following error will occur if there's custom field. | |
``` | |
! Cannot freeze field 'myapp.mymodel.entity_type' | |
! (this field has class myapp.fields.EntityTypeField) | |
! South cannot introspect some fields; this is probably because they are custom | |
! fields. If they worked in 0.6 or below, this is because we have removed the | |
! models parser (it often broke things). |
This file contains hidden or 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 getQueryParam(key) { | |
key = key.replace(/[*+?^$.\[\]{}()|\\\/]/g, "\\$&"); // escape RegEx meta chars | |
var match = location.search.match(new RegExp("[?&]"+key+"=([^&]+)(&|$)")); | |
return match && decodeURIComponent(match[1].replace(/\+/g, " ")); | |
} | |
// ?id=123 | |
// getQueryParam('id') --> 123 |
This file contains hidden or 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
# vim: ft=sh:ts=4:sw=4:autoindent:expandtab: | |
# Source: https://github.com/django/django/blob/stable/1.5.x/extras/django_bash_completion | |
# ######################################################################### | |
# This bash script adds tab-completion feature to django-admin.py and | |
# manage.py. | |
# | |
# Testing it out without installing | |
# ================================= | |
# |
OlderNewer