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
# ~/.bashrc | |
alias ll='ls -alF' | |
alias la='ls -A' | |
alias l='ls -CF' | |
alias rm='rm -i' | |
alias ccc="sudo chmod 775 -R" | |
alias ddd="sudo chown apache:nobody -R" | |
alias eee="sudo chmod 777 -R" | |
alias mydiff='diff -ENwbur' | |
alias ntt='netstat -nt' |
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 | |
/** | |
* http://www.php.net/manual/en/datetime.diff.php | |
* (PHP 5 >= 5.3.0) | |
* | |
* Calculate datetime interval. | |
*/ | |
// Set timezone if need. | |
date_default_timezone_set('Asia/Taipei'); |
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
<html> | |
<head> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script> | |
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.9.1/jquery-ui.min.js"></script> | |
</head> | |
<body> | |
<form id="FormSet" action="/abc" method="get" accept-charset="utf-8"> | |
<input type="text" name="start_date" id="datepicker1" value=""> | |
<input type="submit" value="Search it!"> |
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 | |
/** | |
* Need '$pagitor2' variable. | |
* Example: | |
* $pagitor2 = array( | |
* 'total' => 100, | |
* 'limit' => 15, | |
* 'page' => 2, // current page | |
* //'range' => 3, // optional. | |
* //'method' => 'get' // opt |
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
## base.R | |
library(DBI) | |
library(RMySQL) | |
DB_CONFIG <- list( | |
local = list(driver = 'MySQL', user = 'root', password = '', host = 'localhost'), | |
production = list(driver = 'MySQL', user = 'root', password = '', host = 'localhost') | |
) | |
db_con <- function(environ, db) { |
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
# in some views.py, to serve a csv file in Django. | |
# -*- coding: utf-8 -*- | |
import csv | |
from django.http import HttpResponse | |
def donwload_csv(request): | |
# change export csv formatting by request parameter. ( url?encode=utf-8 ) | |
encode = request.GET.get('encode', 'big5') |
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 | |
// need to set a valid timezone. | |
date_default_timezone_set('Asia/Taipei'); | |
/** | |
* @param | |
* $string: date string, '2013-12-12 01:23:44' | |
* | |
* @return: | |
* string type => '2013-12-12T01:23:44Z' |
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
## install deps if need | |
yum -y install openssl-devel readline-devel bzip2-devel sqlite-devel zlib-devel ncurses-devel db4-devel expat-devel | |
## if build from python src | |
cd ~ | |
mkdir src | |
cd src | |
wget http://www.python.org/ftp/python/2.7.6/Python-2.7.6.tgz | |
tar zxvf Python-2.7.6.tgz | |
cd Python-2.7.6 |
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
// ==UserScript== | |
// @name Vote counting for C_Chat@PTT | |
// @namespace https://github.com/kilfu0701 | |
// @description Counting votes. | |
// @match http://www.ptt.cc/bbs/C_Chat/*.html | |
// @match http://www.ptt.cc/bbs/Test/*.html | |
// @run-at document-end | |
// @include * | |
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js | |
// @version 1.4 |
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 django import http | |
try: | |
from django.conf import settings | |
XS_SHARING_ALLOWED_ORIGINS = settings.XS_SHARING_ALLOWED_ORIGINS | |
XS_SHARING_ALLOWED_METHODS = settings.XS_SHARING_ALLOWED_METHODS | |
XS_SHARING_ALLOWED_HEADERS = settings.XS_SHARING_ALLOWED_HEADERS | |
XS_SHARING_ALLOWED_CREDENTIALS = settings.XS_SHARING_ALLOWED_CREDENTIALS | |
except AttributeError: | |
XS_SHARING_ALLOWED_ORIGINS = '*' |
OlderNewer