Skip to content

Instantly share code, notes, and snippets.

View eit's full-sized avatar
💭
I'm back

Jayson LP Chen eit

💭
I'm back
View GitHub Profile
@eit
eit / nginx.conf
Last active August 29, 2015 14:06
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@eit
eit / es.sh
Last active August 29, 2015 14:18
Install elastic search on Ubuntu 14.04
cd ~
### Install default-jre
sudo apt-get update
sudo apt-get install default-jre
### Check http://www.elasticsearch.org/download/ for latest version of ElasticSearch and replace wget link below
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-1.7.1.deb
sudo dpkg -i elasticsearch-1.7.1.deb
#!/bin/sh
# size of swapfile in megabytes
swapsize=512
# does the swap file already exist?
grep -q "swapfile" /etc/fstab
# if not then create it
if [ $? -ne 0 ]; then
@eit
eit / elasticsearch.yml
Last active September 30, 2015 14:37 — forked from reyjrar/elasticsearch.yml
ElasticSearch config for a write-heavy cluster
##################################################################
# /etc/elasticsearch/elasticsearch.yml
#
# Base configuration for a write heavy cluster
#
# Cluster / Node Basics
cluster.name: logng
# Node can have abritrary attributes we can use for routing
class Solution {
public:
bool wordPattern(string pattern, string str) {
vector<string> words = split(str, ' ');
map<char, string> strMap;
map<string, string> checkWord;
if (pattern.length() == 0 || str.length() == 0)
return false;
if (words.size() != pattern.length())
<?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>万</key>
<string>萬</string>
<key>与</key>
<string>與</string>
<key>专</key>
<string>專</string>
<script>
if ((navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/Android/i)) ||
(navigator.userAgent.match(/iPod/i))||
(navigator.userAgent.match(/Windows Phone OS 7/i)))
{
location.replace("mobile.aspx");
}
</script>
SELECT user_id
FROM `facebook_active_user_201303`
WHERE page_id = '145649977189'
AND startdate = '2013-03-01'
AND period = 'month'
AND user_id
IN
(
SELECT user_id
FROM `facebook_active_user_201303`
{
"array": [
{
"location": {
"lat": 123,
"long": 456,
"address": "xxxxxx"
},
"uid": "12345"
"tel": "0912345678",
//指定ContentType
context.Response.ContentType = _contentType;
//檔案Response出去 註:這邊會將檔案整個Response出去但是並不會顯示路徑!!
context.Response.WriteFile(ConfigurationManager.AppSettings["files_folder_PhysicalPath"] + _file);
string _fileName = HttpUtility.UrlPathEncode( Path.GetFileName(_file));
string strContentDisposition = String.Format("{0}; filename=\"{1}\"", "inline", _fileName);
context.Response.AddHeader("Content-Disposition", strContentDisposition);