ssh root@YOURDOMAIN
adduser deploy
visudo # Add deploy ALL=(ALL) ALL
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
### Step 1: Install xvfb | |
> # apt-get install xvfb | |
### Step 2: Create and enable the init script for the xvfb daemon | |
Note “:0″ in XVFBARGS which sets to display 0, and the –set-guid parameter, which runs the daemon as the www-data user. If you are not running a headless server, make sure to change all references to “:0″ to “:#” (ie: :1, :2 or :22) to avoid conflicts with your existing X session(s) | |
Move xvfb_v2 to in “/etc/init.d/xvfb”: |
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
# Setting sublime line 3 | |
### 下载链接 - https://www.sublimetext.com/3 | |
### 创建别名 `subl` | |
sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl | |
### Install package control | |
source link:https://packagecontrol.io/installation | |
open sublime - show console |
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 ubuntu | |
# MAINTAINER email#dot.com | |
# Add the PostgreSQL PGP key to verify their Debian packages. | |
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc | |
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 | |
# Add PostgreSQL's repository. It contains the most recent stable release | |
# of PostgreSQL, ``9.6``. | |
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list |
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
1. Write Dockerfile | |
Download PG9.6 - Dockerfile (https://gist.github.com/encoreshao/3859bffca218994bb26a82015f76f150) | |
2. Make a docker image command | |
> Docker build --rm = true -t postgres: 9.6. | |
3. Run PostgreSQL On Docker - (5433: 5432) Local Port 5433 Mapping 5432 in docker | |
> Docker run -i -t -p 5433: 5432 postgres: 9.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
SELECT salesforce_accounts.*, salesforce_tasks.*, salesforce_accounts.id AS salesforce_account_id, salesforce_tasks.id AS salesforce_task_id FROM "salesforce_accounts" | |
LEFT JOIN salesforce_tasks ON salesforce_accounts.salesforce_id = salesforce_tasks.account_id | |
LEFT JOIN companies ON companies.salesforce_id = salesforce_accounts.salesforce_id | |
WHERE | |
( | |
( | |
salesforce_tasks.owner_id = 'xxxxxxxxxxxxx' | |
AND salesforce_tasks.is_deleted = 'f' | |
AND salesforce_tasks.activity_date <= '2017-06-11' | |
AND salesforce_tasks.activity_date >= '2017-04-04' |
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
## Zip excluding specific directories | |
Exclude *.git* file and *node_modules* directory | |
$ zip -r9 [target_file] [source_file] -x *.git* node_modules/\* | |
Exclude *.git* file and files in *node_modules* directory, but keep *node_modules* directory | |
$ zip -r9 [target_file] [source_file] -x *.git* node_modules/**\* |
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 Javascript file | |
var realtimeSearchWithDelay = (function(){ | |
var timer = 0; | |
return function(callback, ms){ | |
clearTimeout (timer); | |
timer = setTimeout(callback, ms); | |
}; | |
})(); | |
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
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
OlderNewer