Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

long nguyen nguyentienlong

💭
I may be slow to respond.
Block or report user

Report or block nguyentienlong

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View aws_logs_installation_on_ec2.sh
#!/usr/bin/env bash
# install awscli
python2 -m pip install awscli
# create aws sym link if any issue
ln -s /usr/local/bin/aws /var/awslogs/bin/aws
# install awscli-cwlogs
@nguyentienlong
nguyentienlong / gist:7b0c899fcd664e5dc78268436dc8ec8f
Created Aug 3, 2018
aws cli - copy and flatten nested s3 files structure
View gist:7b0c899fcd664e5dc78268436dc8ec8f
aws s3 ls source-bucket-name - recursive | grep -E "\w+\.+" | awk -F" " '{for(i=4; i<=NF; i++){printf "s3://%s", $i}; printf "\n"}' | head -n5 | xargs -I$ aws s3 cp $ s3://destination-bucket-name/
@nguyentienlong
nguyentienlong / server tricks
Last active May 3, 2018
sudo without password
View server tricks
## sudo without pwd
```
longka ALL=(ALL) NOPASSWD: ALL
%sudo ALL=(ALL:ALL) NOPASSWD: ALL
```
--
## disable ssh with pass
@nguyentienlong
nguyentienlong / wordpress_sub_dir.conf
Last active Jan 28, 2019
wordpress subdir on nginx with anther nodejs web app
View wordpress_sub_dir.conf
server {
root /home/thixanvat/prod/web;
server_name thixanvat.com www.thixanvat.com;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
location /assets/ {
View PYTHONPATH
PYTHONPATH=. python test/test.py
@nguyentienlong
nguyentienlong / wp sub dir config
Created Apr 16, 2018
wordpress url rewrite for blog sub dir
View wp sub dir config
rewrite ^/blog/wp-admin/$ /blog/wp-admin/options-general.php permanent;
rewrite ^/blog/(.*)/$ /blog/index.php?$1 last;
View x.blog.conf
server {
root /home/example/stag/web;
server_name stag-web.example.vn www.stag-web.example.vn;
location /assets/ {
alias /home/example/stag/web/build/public/assets/;
add_header Cache-Control public;
}
location /blog {
@nguyentienlong
nguyentienlong / booking_resource_refactor1.py
Last active Mar 26, 2018
Booking Resource refactoring 1
View booking_resource_refactor1.py
from app import log
logger = log.get_logger()
class BookingResource(object):
def __init(self):
pass
def on_put(self, req, resp, booking_id):
try:
View booking_resource.py
from app import log
logger = log.get_logger()
class BookingResource(object):
def __init(self):
pass
def on_put(self, req, resp, booking_id):
try:
@nguyentienlong
nguyentienlong / curl.md
Created Mar 7, 2018 — forked from subfuzion/curl.md
curl POST examples
View curl.md

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

You can’t perform that action at this time.