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 / Edubots-dedicated-tw.swagger.json
Last active December 28, 2017 15:39
swagger.json for swagger-ui
{
"swagger": "2.0",
"info": {
"version": "v1",
"title": "Edubots情緒rule專用api",
"description": "用於edubots機器人,透過連網方式取得情緒規則與表情圖集等資料,與使用者互動"
},
"tags": [ {
"name" : "emotion rule",
"description" : "情緒規則api"
<?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>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.0</real>
startdate=2013-03-15
enddate=2013-04-14
curr="$startdate"
while true; do
echo "$curr"
[ "$curr" \< "$enddate" ] || break
curr=$( date +%Y-%m-%d --date "$curr +1 day" )
done
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())
@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
#!/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 / 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
@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;
{
"bold_folder_labels": true,
"color_scheme": "Packages/User/Monokai Soda.tmTheme",
"disabled_single_snippet_for_scopes": "text.html, er, pe, pc, if, ife, else, elsif, end, lt",
"ensure_newline_at_eof_on_save": true,
"file_exclude_patterns":
[
"*.pyc",
"*.pyo",
"*.exe",
//判斷是否是UTF8
private function isUTF8($word)
{
if (preg_match("/^([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){1}$/",$word) == true || preg_match("/([".chr(228)."-".chr(233)."]{1}[".chr(128)."-".chr(191)."]{1}[".chr(128)."-".chr(191)."]{1}){2,}/",$word) == true)
{
return true;
}
else
{
return false;