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
joseph-zhong / htpasswd.py
Created May 29, 2020 04:14 — forked from guerrerocarlos/htpasswd.py
Python script for generating htaccess passwords
#!/usr/bin/python
"""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
joseph-zhong / git_python_current_branch.py
Created April 14, 2019 19:06 — forked from igniteflow/git_python_current_branch.py
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

Metadata

...

"time_range_start": 
"time_range_end": 
"time_range_start": 
@joseph-zhong
joseph-zhong / tensorflow_cuda_osx.md
Created March 11, 2017 11:17 — forked from Mistobaan/tensorflow_cuda_osx.md
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.

Prerequisites

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.
Let:
class Base {
public:
int publicMember;
protected:
public class BackgroundVideoRecorder extends Service implements SurfaceHolder.Callback {
private WindowManager windowManager;
private SurfaceView surfaceView;
private Camera camera = null;
private MediaRecorder mediaRecorder = null;
@Override
public void onCreate() {
@joseph-zhong
joseph-zhong / MODES.md
Created January 24, 2017 23:18
Android Battery Modes
Power save
Min: 300 MHz
Max: 1036 MHz
Governor: INTERACTIVE
I/O scheduler: ROW
Cores: 0 and 3 only

Efficiency
Min: 300 MHz
@joseph-zhong
joseph-zhong / BUILD_AWS_LAMBDA.md
Last active March 26, 2019 21:11 — forked from mmitou/how-to-build-opencv3.0.0-for-aws-lambda.md
Building OpenCV for AWS Lambda Python

To build OpenCV3.0 for AWS Lambda Python

Summary

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
joseph-zhong / README.md
Created December 26, 2016 06:25
Android "Normal" and "Dangerous" permissions

Permissions

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

PROTECTION_NORMAL:

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

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