Skip to content

Instantly share code, notes, and snippets.

View joseph-zhong's full-sized avatar

Joseph Zhong joseph-zhong

View GitHub Profile
joseph-zhong /
Created May 29, 2020 04:14 — forked from guerrerocarlos/
Python script for generating htaccess passwords
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
joseph-zhong /
Created April 14, 2019 19:06 — forked from igniteflow/
GitPython get current active branch
Gets the name of the active Git branch as a string.
Depends on GitPython
pip install GitPython
from git import Repo
repo = Repo('/path/to/your/repo')
branch = repo.active_branch



joseph-zhong /
Created March 11, 2017 11:17 — forked from Mistobaan/
How to enable cuda support for tensor flow on Mac OS X (Updated on April:2016 Tensorflow 0.8)

These instructions will explain how to install tensorflow on mac with cuda enabled GPU suport. I assume you know what tensorflow is and why you would want to have a deep learning framework running on your computer.


Make sure to update your homebrew formulas

brew update
To answer that question, I'd like to describe member's accessors first in my own words. If you already know this, skip to the heading "next:".
There are three accessors that I'm aware of: public, protected and private.
class Base {
int publicMember;
public class BackgroundVideoRecorder extends Service implements SurfaceHolder.Callback {
private WindowManager windowManager;
private SurfaceView surfaceView;
private Camera camera = null;
private MediaRecorder mediaRecorder = null;
public void onCreate() {
joseph-zhong /
Created January 24, 2017 23:18
Android Battery Modes
Power save
Min: 300 MHz
Max: 1036 MHz
I/O scheduler: ROW
Cores: 0 and 3 only

Min: 300 MHz
joseph-zhong /
Last active March 26, 2019 21:11 — forked from mmitou/
Building OpenCV for AWS Lambda Python

To build OpenCV3.0 for AWS Lambda Python


Because AWS Lambda runs in a Amazon Linux environment, to run external modules you must

Create the OpenCV build environment

sudo yum update -y
joseph-zhong /
Created December 26, 2016 06:25
Android "Normal" and "Dangerous" permissions


As of API level 23, the following permissions are classified as normal and dangerous


joseph-zhong /
Created December 22, 2016 22:37
Boto3 Multipart upload
total_bytes = os.stat('path/to/file').st_size
def upload_callback(bytes, progress_bytes=PROGRESS_BYTES):
  progress_bytes += bytes
  sys.stdout.write('part uploaded: %d of %d bytes' % (progress_bytes, total_bytes))

with open(output_file, 'rb') as ouput_data: