Skip to content

Instantly share code, notes, and snippets.

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

Thinh Tran duythinht

💭
I may be slow to respond.
View GitHub Profile
[ui]
username=duythinht <duythinht@gmail.com>
[auth]
bb.prefix = hg.saritasa.com:6060
bb.username = ThinhTran
bb.password = s=k$-[_K:
bb.schemes = http https
[hostfingerprints]
export ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future
export CFLAGS=-Qunused-arguments

App Engine update cloudstorage using SDK and GAE production

This code shows how to read and write blobs and how to create a serving url.

The blobfiles can be images or other files like css, js and pdf's. We use the default bucket in Google Cloud Storage (GCS) to store the blobs.
From the docs: An application can use the default GCS bucket, which provides an already configured bucket with free quota.

This code still needs the blobstore.create_gs_key() for images.get_serving_url()
We use an image serving url for dynamic resizing and cropping.

@duythinht
duythinht / upload_api.py
Created August 26, 2014 15:54
Upload file via flask with appengine
from flask import Blueprint
from flask import render_template as render
from flask import request, Response
import cloudstorage as gcs
from google.appengine.api import app_identity
from os import environ
from json import dumps
module = Blueprint('API_UPLOAD', __name__)
@duythinht
duythinht / move.py
Created September 2, 2014 13:28
VIM moving
# Go to line 3
3 G
# Delete from line 3 to 6
3 G
d 6 G
# copy to clipboard
" + Y
# paste from clipboard
" + P
# Go to 3 words as begin
@duythinht
duythinht / .tmux.conf
Last active August 29, 2015 14:06
VIM working Environment
#set-option -g default-command "reattach-to-user-namespace -l bash"
set -g default-terminal "screen-256color"
set -g base-index 1
set -g pane-base-index 1
#### COLOUR (Solarized 256)
# default statusbar colors
<?php
//This code read the necessary data form the standard input
function isPrime($n) {
if ($n == 1) return false;
if($n == 2) return true;
if ($n % 2 == 0) return false;
for($i = 3; $i <= ceil(sqrt($n)); $i = $i + 2) {
from flask import Blueprint
from flask import request
module = Blueprint('api_users', __name__)
@module.route('/', methods=['GET'])
def list():
pass
[user]
name = Thinh Tran
email = duythinht@gmail.com
[push]
default = current
[core]
excludesfile = /Users/duythinht/.gitignore_global
editor = /usr/bin/vim
[difftool "sourcetree"]
@duythinht
duythinht / postactivate
Created March 1, 2016 04:10
.virtualenvs/postactivate
#!/bin/zsh
# This hook is sourced after every virtualenv is activated.
PS1="$_OLD_VIRTUAL_PS1"
_OLD_RPROMPT="$RPROMPT"
RPROMPT="%{${fg_bold[white]}%}「 %{${fg[green]}%}`basename \"$VIRTUAL_ENV\"`%{${fg_bold[white]}%} 」%{${reset_color}%}$RPROMPT"