I hereby claim:
- I am baysao on github.
- I am baysao (https://keybase.io/baysao) on keybase.
- I have a public key whose fingerprint is 3EEB 31AE B377 041D E5A1 F3F1 A587 8683 5EC4 2291
To claim this, I am signing this object:
-- Remove the history from | |
rm -rf .git | |
-- recreate the repos from the current content only | |
git init | |
git add . | |
git commit -m "Initial commit" | |
-- push to the github remote repos ensuring you overwrite history | |
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git |
I hereby claim:
To claim this, I am signing this object:
[05/Jul/2017 04:05:40] ERROR [django.request:256] Internal Server Error: /backend/cm/page/trang-chu/ | |
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response | |
response = wrapped_callback(request, *callback_args, **callback_kwargs) | |
File "/usr/local/lib/python2.7/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view | |
return view_func(*args, **kwargs) | |
File "/usr/local/lib/python2.7/site-packages/django/views/generic/base.py", line 71, in view | |
return self.dispatch(request, *args, **kwargs) | |
File "/usr/local/lib/python2.7/site-packages/rest_framework/views.py", line 477, in dispatch | |
response = self.handle_exception(exc) |
[ -e /usr/lib/apt/methods/https ] || { | |
apt-get update | |
apt-get install -y apt-transport-https | |
} | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 | |
sh -c "echo deb https://get.docker.com/ubuntu docker main > /etc/apt/sources.list.d/docker.list" | |
apt-get update | |
apt-get install -y --force-yes apparmor lxc-docker |
#!/bin/bash | |
echo '==================================================' | |
echo '===============Install necessary tools===============' | |
echo '==================================================' | |
sudo yum update | |
sudo yum install git make flex bison libtool automake openssl-devel libevent libevent-devel python-devel gcc-c++ byacc java-1.7.0-openjdk ant | |
echo '==================================================' |
Secure sessions are easy, but it's not very well documented, so I'm changing that. | |
Here's a recipe for secure sessions in Node.js when NginX is used as an SSL proxy: | |
The desired configuration for using NginX as an SSL proxy is to offload SSL processing | |
and to put a hardened web server in front of your Node.js application, like: | |
[NODE.JS APP] <- HTTP -> [NginX] <- HTTPS -> [CLIENT] | |
To do this, here's what you need to do: |
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 400,000 to 500,000 requests per second (clustered), most what i saw is 50,000 to 80,000 (non-clustered) requests per second and 30% CPU load, course, this was 2xIntel Xeon with HT 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.
First, you will need to install nginx, my way to install nginx is compiling it from source, but for now we will use apt-get
source s_nginx_20 { pipe("/srv/logs/access.log" program_override("nginx-access-log")); }; | |
source s_nginx_21 { pipe("/srv/logs/error.log" program_override("nginx-error-log")); }; | |
filter f_nginx_20 { match("nginx-access-log" value("PROGRAM")); }; | |
filter f_nginx_21 { match("nginx-error-log" value("PROGRAM")); }; | |
destination d_remote { tcp("central.syslog", port(514)); }; | |
log { source(s_nginx_20); filter(f_nginx_20); destination(d_messages); }; | |
log { source(s_nginx_21); filter(f_nginx_21); destination(d_messages); }; |
# https://www.erlang-solutions.com/downloads/download-erlang-otp | |
# wget http://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb | |
# sudo dpkg -i erlang-solutions_1.0_all.deb | |
deb http://packages.erlang-solutions.com/ubuntu trusty contrib | |
deb http://packages.erlang-solutions.com/ubuntu saucy contrib | |
deb http://packages.erlang-solutions.com/ubuntu precise contrib | |
wget http://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | |
sudo apt-key add erlang_solutions.asc |
-- gets all fields from a hash as a dictionary | |
local hgetall = function (key) | |
local bulk = redis.call('HGETALL', key) | |
local result = {} | |
local nextkey | |
for i, v in ipairs(bulk) do | |
if i % 2 == 1 then | |
nextkey = v | |
else | |
result[nextkey] = v |