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
import arrow | |
def create_datetime_from_timeago(text, timezone='Asia/Saigon'): | |
""" | |
Create datetime object from timeago string. | |
Author: anhtran <anhtran.net> | |
:param str text: | |
:param str timezone: | |
Example: | |
5 phút trước |
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
/* https://www.userchrome.org/what-is-userchrome-css.html */ | |
/* Preview: https://imgur.com/kZmJ75T */ | |
.requests-list-file.requests-list-column { | |
background-color: #48654b1a !important; | |
color: #ddd !important; | |
min-width: 300px !important; | |
direction: rtl !important; | |
} | |
.requests-list-file.requests-list-column[title*='/web-api'] { |
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
<script type="text/javascript"> | |
WebFontConfig = { | |
google: { families: [ 'Roboto' ] } | |
}; | |
(function() { | |
var wf = document.createElement('script'); | |
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') + | |
'://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js'; | |
wf.type = 'text/javascript'; | |
wf.async = 'true'; |
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
# Run command: `java -Xmx1g -XX:MaxMetaspaceSize=250m -Djava.awt.headless=true -jar youtrack-xxxx.x.xxx.jar my.domain.com:9988` | |
upstream youtrack_upstream { | |
server my.domain.com:9988; | |
} | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} |
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
# created by @anhtt <anhtran.net>, 2018/05/23 | |
# 63 cities and provices of Vietnam, updated in 2024. | |
PROVINCES = { | |
'HCMC': 'Hồ Chí Minh', | |
'HANOI': 'Hà Nội', | |
'HAIPHONG': 'Hải Phòng', | |
'DANANG': 'Đà Nẵng', | |
'CANTHO': 'Cần Thơ', | |
'HAGIANG': 'Hà Giang', |
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
def compound_unicode(unicode_str): | |
""" | |
Chuyển đổi chuỗi Unicode Tổ Hợp sang Unicode Dựng Sẵn | |
Edited from: `https://gist.github.com/redphx/9320735` | |
""" | |
unicode_str = unicode_str.replace("\u0065\u0309", "\u1EBB") # ẻ | |
unicode_str = unicode_str.replace("\u0065\u0301", "\u00E9") # é | |
unicode_str = unicode_str.replace("\u0065\u0300", "\u00E8") # è | |
unicode_str = unicode_str.replace("\u0065\u0323", "\u1EB9") # ẹ | |
unicode_str = unicode_str.replace("\u0065\u0303", "\u1EBD") # ẽ |
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
# (c) 2018 Anh Tran <anhtran.net> | |
import requests | |
from PIL import ImageSequence | |
def fetch_chap_img(img_url): | |
""" Get image from internet then saving it on disk """ | |
r = requests.head(img_url) | |
if r.status_code == 200: | |
r = requests.get(img_url) |
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
# sets the proxy cache path location, max size 2g | |
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:100m inactive=24h max_size=2g; | |
# transfers the `Host` header to the backend | |
proxy_set_header Host $host; | |
# uses the defined STATIC cache zone | |
proxy_cache STATIC; | |
# cache 200 10 minutes, 404 1 minute, others status codes not cached |
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
#!/usr/bin/env python | |
# coding: utf-8 | |
# You need PIL <http://www.pythonware.com/products/pil/> to run this script | |
# Download unifont.ttf from <http://unifoundry.com/unifont.html> (or use | |
# any TTF you have) | |
# Copyright 2011 Álvaro Justen [alvarojusten at gmail dot com] | |
# License: GPL <http://www.gnu.org/copyleft/gpl.html> | |
from image_utils import ImageText |
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
#!/bin/bash | |
cd /home/username/webapps/my_ghost_blog | |
curl -LOk https://ghost.org/zip/ghost-latest.zip | |
unzip ghost-latest.zip -d ghost-latest | |
cd ./ghost | |
rm -rf core index.js package.json npm-debug.log *.md | |
cp -R ../ghost-latest/core . | |
cp -R ../ghost-latest/index.js . |