Skip to content

Instantly share code, notes, and snippets.

View xuanhan863's full-sized avatar
๐Ÿ‘€
In machine learning...

Slice xuanhan863

๐Ÿ‘€
In machine learning...
  • Los Angeles, USA
View GitHub Profile

Movies Recommendation:

Music Recommendation:

#!/usr/local/python/bin
# coding=utf-8
'''Implements a simple log library.
This module is a simple encapsulation of logging module to provide a more
convenient interface to write log. The log will both print to stdout and
write to log file. It provides a more flexible way to set the log actions,
and also very simple. See examples showed below:
@xuanhan863
xuanhan863 / dlib_plus_osm.md
Created November 11, 2015 04:44 — forked from iandees/dlib_plus_osm.md
Detecting Road Signs in Mapillary Images with dlib C++

image

I've been interested in computer vision for a long time, but I haven't had any free time to make any progress until this holiday season. Over Christmas and the New Years I experimented with various methodologies in OpenCV to detect road signs and other objects of interest to OpenStreetMap. After some failed experiments with thresholding and feature detection, the excellent /r/computervision suggested using the dlib C++ module because it has more consistently-good documentation and the pre-built tools are faster.

After a day or two figuring out how to compile the examples, I finally made some progress:

Compiling dlib C++ on a Mac with Homebrew

  1. Clone dlib from Github to your local machine:
@xuanhan863
xuanhan863 / springer-free-maths-books.md
Created December 29, 2015 04:02 — forked from bishboria/springer-free-maths-books.md
Springer have made a bunch of maths books available for free, here are the direct links
@xuanhan863
xuanhan863 / OverEncrypt.md
Created December 2, 2016 10:24 — forked from mapmeld/OverEncrypt.md
OverEncrypt - paranoid HTTPS

OverEncrypt

This is a guide that I wrote to improve the default security of my website https://fortran.io , which has a certificate from LetsEncrypt. I'm choosing to improve HTTPS security and transparency without consideration for legacy browser support.

WARNING: if you mess up settings, lose your certificates, or decide to no longer maintain HTTPS certs, these steps can and will make your domain inaccessible.

I would recommend these steps only if you have a specific need for information security, privacy, and trust with your users, and/or maintain a separate secure.example.com domain which won't mess up your main site. If you've been thinking about hosting a site on Tor, then this might be a good option, too.

The best resources that I've found for explaining these steps are https://https.cio.gov , https://certificate-transparency.org , and https://twitter.com/konklone

@xuanhan863
xuanhan863 / local_settings.py
Created December 8, 2016 06:40 — forked from rochacbruno/local_settings.py
Django Profiling Middleware with hotshot or Cprofile
MIDDLEWARE_CLASSES = MIDDLEWARE_CLASSES + (
'yourapp.middleware.ProfileMiddleware',
'yourapp.middleware.CProfileMiddleware'
)
@xuanhan863
xuanhan863 / nginx.conf
Created December 27, 2016 10:54 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@xuanhan863
xuanhan863 / get_lat_lon_exif_pil.py
Created August 21, 2018 06:14 — forked from erans/get_lat_lon_exif_pil.py
Get Latitude and Longitude from EXIF using PIL
from PIL import Image
from PIL.ExifTags import TAGS, GPSTAGS
def get_exif_data(image):
"""Returns a dictionary from the exif data of an PIL Image item. Also converts the GPS Tags"""
exif_data = {}
info = image._getexif()
if info:
for tag, value in info.items():
decoded = TAGS.get(tag, tag)