Note: For newer versions of NodeJS, Nginx and MongoDB, checkout their websites and update the related parts.
run all the commands in terminal as the root user (sudo su)
yum update
yum install -y epel-release| const log = (...args) => console.log(`[${new Date().toLocaleString()}]`, ...args); | |
| module.exports = log; | |
| // log(1,2,3) --> [2018-3-10 01:42:21] 1 2 3 | |
| // log([1,2,3]) --> [2018-3-10 01:43:47] [ 1, 2, 3 ] | |
| // log('this is:', this) --> [2018-3-10 01:43:01] this is: { console: [Getter],............} |
| /** | |
| * The Maybe type encapsulates an optional value. | |
| */ | |
| export class Maybe<T> { | |
| /** Create an empty value. */ | |
| static nothing<T>(): Maybe<T> { | |
| return new Maybe<T>(undefined); | |
| } | |
| /** Create a non-empty value. */ |
ffmpeg -i input.avi -c:v libx265 output.mp4
ffmpeg -i input.avi -c:v libx264 output.mp4
ffmpeg -i input.mp4 -c:v flv output.flv
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -vf "scale=iw/2:ih/2" -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -vf "scale=720:-1" -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -vf "scale=720:trunc(ow/a/2)*2" -c:a copy output.mp4
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -vf "scale=trunc(oh*a/2)*2:720" -c:a copy output.mp4
| // add to User keybindings (find this file with cmd+shift+p; start typing `Key Bindings - User`) | |
| // file located @ [$HOME]/Library/Application Support/Sublime\ Text 3/Packages/User/Default (OSX).sublime-keymap | |
| [ | |
| // Auto-pair backticks | |
| { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": | |
| [ | |
| { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | |
| { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | |
| { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|$)", "match_all": true } | |
| ] |
| // jalali date | |
| JalaliDate = { | |
| month_names: ["فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذر", "دی", "بهمن", "اسفند"], | |
| g_days_in_month: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], | |
| j_days_in_month: [31, 31, 31, 31, 31, 31, 30, 30, 30, 30, 30, 29] | |
| }; | |
| JalaliDate.jalaliToGregorian = function(j_y, j_m, j_d) { | |
| j_y = parseInt(j_y); | |
| j_m = parseInt(j_m); | |
| j_d = parseInt(j_d); |
| cd /etc/yum.repos.d | |
| curl -O https://copr.fedorainfracloud.org/coprs/librehat/shadowsocks/repo/epel-7/librehat-shadowsocks-epel-7.repo | |
| yum -y install shadowsocks-libev | |
| setcap CAP_NET_BIND_SERVICE=+eip /usr/bin/ss-server | |
| cat > /etc/shadowsocks-libev/config.json << 'EOF' | |
| { | |
| "server": "0.0.0.0", | |
| "server_port": 443, | |
| "password": "p@$$w0rd", | |
| "method": "aes-128-gcm" |
| { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`$0`"}, "context": | |
| [ | |
| { "key": "setting.auto_match_enabled", "operator": "equal", "operand": true }, | |
| { "key": "selection_empty", "operator": "equal", "operand": true, "match_all": true }, | |
| { "key": "following_text", "operator": "regex_contains", "operand": "^(?:\t| |\\)|]|\\}|>|$)", "match_all": true }, | |
| { "key": "preceding_text", "operator": "not_regex_contains", "operand": "[`a-zA-Z0-9_]$", "match_all": true }, | |
| { "key": "eol_selector", "operator": "not_equal", "operand": "string.quoted.backtick", "match_all": true } | |
| ] | |
| }, | |
| { "keys": ["`"], "command": "insert_snippet", "args": {"contents": "`${0:$SELECTION}`"}, "context": |
| # Colors | |
| end="\033[0m" | |
| black="\033[0;30m" | |
| blackb="\033[1;30m" | |
| white="\033[0;37m" | |
| whiteb="\033[1;37m" | |
| red="\033[0;31m" | |
| redb="\033[1;31m" | |
| green="\033[0;32m" | |
| greenb="\033[1;32m" |
For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.
Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.
You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.