Skip to content

Instantly share code, notes, and snippets.

View nguyentruongtho's full-sized avatar

Tho Neyugn nguyentruongtho

View GitHub Profile
/*
* Copyright (C) 2013 Square, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@nguyentruongtho
nguyentruongtho / creditpurge.py
Created May 3, 2014 11:41
Purge all credit signatures which are automatically created by IntelliJ
#!/usr/bin/env python
import os
import re
LIST_SUBMODULE_COMMAND = "awk /path\ =\ / .gitmodules|awk '{print $3}'"
SIGNATURE_INSET = "Created "
SIGNATURE_BEGIN = "/**"
SIGNATURE_END = " */"
package com.company;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Random;
public class ClassWithNakedConstructorInstantiationBenchMark {
static final int COUNT = 1000000;
static final String CLASS_NAME = HelloWorld.class.getName();
// signing.properties
STORE_FILE=../app.jks
STORE_PASSWORD=**pass**
KEY_ALIAS=**key**
KEY_PASSWORD=**pass**
// app.gradle
File propFile = file('signing.properties');
if (propFile.exists()) {
def reverseProxy = Action.async(parse.raw) {
request: Request[RawBuffer] =>
// Create the request to the upstream server:
val proxyRequest =
WS.url("http://localhost:8887" + request.path)
.withFollowRedirects(false)
.withMethod(request.method)
.withVirtualHost("localhost:9000")
.withHeaders(flattenMultiMap(request.headers.toMap): _*)
.withQueryString(request.queryString.mapValues(_.head).toSeq: _*)
#!/usr/bin/env python
import re
import sys
from os import listdir
from os.path import isfile, join, basename, normpath
def usage():
print """
usage: remove_non_translatable <path/to/values-xxx/folder>
@nguyentruongtho
nguyentruongtho / activity.py
Created October 27, 2015 16:18
Start an activity using adb without pain.
#!/usr/bin/env python
"""
Running an activity from terminal using adb is more complex than necessary,
you have to find the package and activity names, combine them together
and place them in a command that you probably will forget right after
using it.
We should only give the name of an activity for running one!
This file has been truncated, but you can view the full file.
{"packages_cache": {"https://raw.githubusercontent.com/kairyou/sublime_packages/master/packages.json": [{"homepage": "https://github.com/kairyou/SublimeSimpleSync", "description": "Simple ST2/ST3 plugin for synchronize local and remote files", "releases": [{"sublime_text": "*", "date": "2015-11-16 06:10:02", "platforms": ["*"], "version": "1.0.13", "url": "https://codeload.github.com/kairyou/SublimeSimpleSync/zip/1.0.13"}], "authors": ["tnhu", "gfreezy", "kairyou"], "issues": "https://github.com/kairyou/SublimeSimpleSync/issues", "name": "SublimeSimpleSync", "donate": null, "previous_names": [], "labels": [], "buy": null, "readme": "https://raw.githubusercontent.com/kairyou/SublimeSimpleSync/master/README.md"}, {"homepage": "https://github.com/kairyou/SublimeTmpl", "description": "Create File From Templates for ST2/ST3.", "releases": [{"sublime_text": "*", "date": "2015-06-19 09:53:20", "platforms": ["*"], "version": "1.1.1", "url": "https://codeload.github.com/kairyou/SublimeTmpl/zip/1.1.1"}, {"sublime_text"
@nguyentruongtho
nguyentruongtho / gifify
Created December 5, 2016 15:56 — forked from berikv/gifify
Transform a movie file to a gif. Specialised for demo's of Mobile app screen recordings.
#!/bin/bash
FFMPEG=`which ffmpeg`
INFILE=$1
OUTFILE="${INFILE}.gif"
TMPFILE="${INFILE}_gifify_palette.png"
if ! $FFMPEG -L > /dev/null 2>&1; then
echo "Run: brew install ffmpeg"
exit -1
#!/usr/bin/env python
# Very useful for buck development, since everytime you change something
# buck version will change, leading to cache being cleaned and all remote
# files will have to be redownloaded again, which takes time.
#
# Put following line at the end of .buckconfig.local
# [download]
# proxy_host=localhost
# proxy_port=8000
# proxy_type=HTTP