Skip to content

Instantly share code, notes, and snippets.

View nguyentienlong's full-sized avatar
💭
I may be slow to respond.

lk nguyentienlong

💭
I may be slow to respond.
  • Vietnam
View GitHub Profile
@nguyentienlong
nguyentienlong / music.md
Created February 20, 2017 02:14 — forked from staltz/music.md
coding music

Not for everyone. Each programmer has their own appreciation of what is good coding music.

For when I need to think deep, debug something, or design

(From most influential to least)

@nguyentienlong
nguyentienlong / utils.py
Created June 13, 2017 03:16
create python object with parameters from json
#!/usr/bin/env python
from sklearn.tree import *
import json
def object_decoder(obj):
klass = globals()[obj['__type__']]
objekt = klass()
for key in obj:
if key != '__type__':
@nguyentienlong
nguyentienlong / remove-breakline-or-enter-character-at-the-end-of-line.txt
Last active June 14, 2017 01:48
remove break line or enter character at the end of line when combining cat and curl
cat ph_check_page.csv | awk '{ gsub("\r?\n|\r", "", $0); print $0 }' | xargs -I$ curl -s -I $ > ph_link_check.log
@nguyentienlong
nguyentienlong / gist:a0301f7319704c44dbe3bdc57ca9fa8d
Created September 10, 2017 16:45
iterm2(material color presets) + oh-my-zsh(agnoster theme, meslo font)
Theme for oh-my-zsh: agnoster
Meslo Font: https://github.com/andreberg/Meslo-Font/blob/master/dist/v1.2.1/Meslo%20LG%20v1.2.1.zip (fontsize 14)
Material Theme for Iterm2: https://github.com/MartinSeeler/iterm2-material-design
@nguyentienlong
nguyentienlong / autoConvert.sh
Created September 30, 2017 04:07 — forked from goliver79/autoConvert.sh
[LINUX] Convert MP4 to MP3
#!/bin/bash
for f in *.mp4
do
echo "Converting $f"
name=`echo "$f" | sed -e "s/.mp4$//g"`
ffmpeg -i "$f" -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 "$name.mp3"
done
@nguyentienlong
nguyentienlong / get-aws-log.sh
Created October 19, 2017 14:26
Filter aws log events within period of time
#!/usr/bin/env bash
usage () {
echo "i4b-request-count.sh"
echo "---- Usage:"
echo "---- i4b-request-count [start-date-time] [end-date-time]"
echo "---- eg: ./i4b-request-count.sh '2017-09-15 00:00:00' '2017-10-15 23:59:59'"
}
E_NO_ARGS=65
if [ -z "$1" ] || [ -z "$2" ]; then
usage
@nguyentienlong
nguyentienlong / nginx.conf
Created October 24, 2017 05:15 — forked from Stanback/nginx.conf
Example Nginx configuration for adding cross-origin resource sharing (CORS) support to reverse proxied APIs
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your **location** block(s):
#
# include cors_support;
#
# As of Nginx 1.7.5, add_header supports an "always" parameter which
@nguyentienlong
nguyentienlong / curl.md
Created March 7, 2018 23:08 — forked from subfuzion/curl.md
curl POST examples

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.

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 / booking_resource_refactor1.py
Last active March 26, 2018 05:40
Booking Resource refactoring 1
from app import log
logger = log.get_logger()
class BookingResource(object):
def __init(self):
pass
def on_put(self, req, resp, booking_id):
try: