Skip to content

Instantly share code, notes, and snippets.

View holmesconan's full-sized avatar

Holmes Conan holmesconan

  • Hebei, China
View GitHub Profile
@holmesconan
holmesconan / saver.php
Created August 19, 2018 12:29
TiddlyWiki 5 PHP Saver
<?php
$uri = $_SERVER['REQUEST_URI'];
$ext = pathinfo($uri, PATHINFO_EXTENSION);
$full_path = $_SERVER['DOCUMENT_ROOT'] . $uri . (empty($ext) ? '.html' : '');
/**
* if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) == $last_modified_time ||
* trim($_SERVER['HTTP_IF_NONE_MATCH']) == $etag) {
* header("HTTP/1.1 304 Not Modified");
* exit;
@holmesconan
holmesconan / generate_tfrecords.py
Last active July 14, 2018 15:54
Convert Pascal VOC dataset to tfrecords file.
"""Convert the Pascal VOC dataset of Classification/Detect to .tfrecords file.
"""
from __future__ import absolute_import
from __future__ import print_function
import os
import argparse
import tensorflow as tf
import skimage.io as skimage_io
from lxml import etree
@holmesconan
holmesconan / vgg.py
Created July 1, 2018 09:23
Memory Optimization With Swap-out in DNN.
# coding: utf-8
# Low Memory VGG model.
import os
import numpy as np
import pandas as pd
import tensorflow as tf
from tensorflow.python.client import timeline
tf.logging.set_verbosity(tf.logging.DEBUG)
@holmesconan
holmesconan / tf-docker-env.sh
Last active June 18, 2018 13:58
Tensorflow GPU deploy script
#!/bin/sh
# This script is used to config tensorflow docker runtime environment on aliyun.
# System should be Ubuntu 16.04
# echo Install NVIDIA driver
# sudo add-apt-repository ppa:graphics-drivers
# sudo apt-get update
# sudo ubuntu-drivers devices
# https://docs.docker.com/install/linux/docker-ce/ubuntu/#install-using-the-repository
{"sig":"cccea3c025698294837b8e2442b2868b8f1fe1b033a202e93aac77f8a36befcbcda8c9113229c5d82649527f7052aa02a60abe86afab8e46f0d2f5b293651b7b0","msghash":"22dfc290a00344129a64c53aa83b63095283d55f7390ccdcd06f11db0e7154bc"}
@holmesconan
holmesconan / ss-local-select-auto.sh
Created November 4, 2017 06:32
Bash script to choose shadowsocks servers.
#!/bin/bash
@holmesconan
holmesconan / flushdns.sh
Created October 30, 2017 02:26
Flush macOS 10.12+ DNS cache
#!/bin/sh
killall -HUP mDNSResponder
killall mDNSResponderHelper
dscacheutil -flushcache
@holmesconan
holmesconan / index.html
Created June 23, 2017 14:02
HTML5 Boilerplate With IE Conditional Tag.
<!DOCTYPE html>
<!--[if lt IE 9]>
<html class="lt-ie9" lang="zh-CN">
<![endif]-->
<!--[if gte IE 9]> -->
<html lang="zh-CN">
<!--<![endif]-->
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
@holmesconan
holmesconan / wordpress.conf
Created December 12, 2016 06:58
Nginx Wordpress Rewrite rules.
server {
server_name example.com ;
access_log /var/log/nginx/example.com.access.log;
error_log /var/log/nginx/example.com.error.log debug;
root /var/www/example.com/htdocs ;
index index.php;
if (!-e $request_filename) {
@holmesconan
holmesconan / nginx.conf
Last active May 26, 2016 14:20
Set prefer domain
server {
listen 80;
server_name example.org;
return 301 http://www.example.org$request_uri;
}