Skip to content

Instantly share code, notes, and snippets.

@quanhua92
quanhua92 / example.java
Created January 29, 2016 08:33
Process android camera without previewing
Camera.Parameters p = mCam.getParameters();
p.setPreviewSize(camHeight, camWidth);
p.setPreviewFpsRange(minFps, maxFps);
mCam.setParameters(p);
texture = new SurfaceTexture(10);
mCam.setPreviewTexture(texture);
mCam.startPreview();
mCam.setPreviewCallback(new PreviewCallback() {
@Override
@quanhua92
quanhua92 / unmkbundle.py
Created January 21, 2017 06:30 — forked from maldroid/unmkbundle.py
A script to unbundle the mkbundle result. Just run it with the libmonodroid_bundle_app.so (or similar) file as a parameter
import sys, gzip
from cStringIO import StringIO
from elftools.elf.elffile import ELFFile
elffile = ELFFile(open(sys.argv[1]))
data = open(sys.argv[1]).read()
is_mkbundle = False
section = elffile.get_section_by_name('.dynsym')
@quanhua92
quanhua92 / MakeHole.sh
Last active March 10, 2017 11:14
Pi-hole without a Pi. On a DO VPS
#!/usr/bin/env bash
# Pi-hole: A black hole for Internet advertisements
# (c) 2015, 2016 by Jacob Salmela
# Network-wide ad blocking via your Raspberry Pi
# http://pi-hole.net
# Installs Pi-hole
#
# Pi-hole is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
@quanhua92
quanhua92 / immediate_reboot.sh
Created June 21, 2017 05:07
Immediate reboot without any lock in reboot process
echo 1 > /proc/sys/kernel/sysrq
echo b > /proc/sysrq-trigger
@quanhua92
quanhua92 / env2.yml
Created August 10, 2017 03:12
conda environment
name: env2
channels:
- https://conda.anaconda.org/menpo
- conda-forge
dependencies:
- python=2.7
- numpy
- matplotlib
- jupyter
- opencv3
@quanhua92
quanhua92 / vim.reg
Created January 4, 2019 05:59
Add Vim.exe to Context Menu (instead of gvim.exe as default)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Vim]
@="Edit with &Vim"
"Icon"="\"C:\\Program Files (x86)\\Vim\\vim81\\vim.exe\""
[HKEY_CLASSES_ROOT\*\Shell\Vim\command]
@="\"C:\\Program Files (x86)\\Vim\\vim81\\vim.exe\" \"%1\""
@quanhua92
quanhua92 / weight_estimation.py
Created March 7, 2019 10:59
weight estimation of MakeHuman
#!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""
MakeHuman plugin for estimating the weight of the model using BSA (body surface
are) based metrics.
**Project Name:** MakeHuman
**Product Home Page:** http://www.makehuman.org/
@quanhua92
quanhua92 / jupyter-lab.md
Created March 9, 2019 07:45
Jupyter Lab Environment

Install JupyterLab and JupyText

conda install -c conda-forge jupyterlab jupytext

Install JupyterLab Table of Contents

jupyter labextension install @jupyterlab/toc
@quanhua92
quanhua92 / alexnet_lrn.py
Created June 17, 2019 06:39
AlexNet: Review and Implementation - deeplearning.vn
"""
This is the implementation of AlexNet which is modified from [Jeicaoyu's AlexNet].
Note:
- The number of Conv2d filters now matches with the original paper.
- Use PyTorch's Local Response Normalization layer which is implemented in Jan 2018. [PR #4667]
- This is for educational purpose only. We don't have pretrained weights for this model.
References:
"""
This is AlexNet implementation from pytorch/torchvision.
Note:
- The number of nn.Conv2d doesn't match with the original paper.
- This model uses `nn.AdaptiveAvgPool2d` to allow the model to process images with arbitrary image size. [PR #746]
- This model doesn't use Local Response Normalization as described in the original paper.
- This model is implemented in Jan 2017 with pretrained model.
- PyTorch's Local Response Normalization layer is implemented in Jan 2018. [PR #4667]
References:
- Model: https://github.com/pytorch/vision/blob/ac2e995a4352267f65e7cc6d354bde683a4fb402/torchvision/models/alexnet.py