Skip to content

Instantly share code, notes, and snippets.

Avatar

Hugo Zhang HugoPresents

View GitHub Profile
View com.chinadns.startup.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>com.chinadns.startup</string>
<key>ProgramArguments</key>
<array>
View reboot_tplink.sh
@HugoPresents
HugoPresents / Paginator.php
Last active Aug 29, 2015
Phalcon simple pagination use bootstrap style
View Paginator.php
<?php
class Paginator
{
public $current;
public $total_pages;
public $next;
public $before;
public $items;
public $query = [];
@HugoPresents
HugoPresents / Dockerfile
Last active Aug 29, 2015
boot2docker nfs for OS X
View Dockerfile
FROM boot2docker/boot2docker:latest
MAINTAINER Tuzki Zhang <rabbitzhang52@gmail.com>
RUN rm $ROOTFS/etc/rc.d/automount-shares && \
sed -i "s/\/etc\/rc.d\/automount-shares//g" $ROOTFS/opt/bootscript.sh && \
echo "#!/bin/sh\n\
/usr/local/etc/init.d/nfs-client start" >> $ROOTFS/opt/bootscript.sh
RUN mkdir $ROOTFS/Users && \
echo "10.0.2.2:/Users /Users nfs defaults 0 0" >> $ROOTFS/etc/fstab
@HugoPresents
HugoPresents / picture.go
Last active Jun 26, 2018
get & save picture size, width and height
View picture.go
package main
import (
"database/sql"
"flag"
"fmt"
_ "github.com/go-sql-driver/mysql"
"github.com/go-yaml/yaml"
"image"
_ "image/gif"
@HugoPresents
HugoPresents / set_cookiejar.go
Created Dec 29, 2014
golang set cookieJar example
View set_cookiejar.go
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/cookiejar"
"net/url"
"strings"
)
@HugoPresents
HugoPresents / vm_io_performance.md
Created Dec 26, 2014
Virtualbox IO Performance
View vm_io_performance.md

~ is local, ~/htdocs mounted by vboxsf, /var/htdocs mounted by nfs.

local

read

root@Ubuntu:~# time dd bs=8k count=300000 if=test of=/dev/zero
300000+0 records in
300000+0 records out
2457600000 bytes (2.5 GB) copied, 3.9852 s, 617 MB/s

real	0m3.990s
View Hackintosh.md

Hackintosh

CPU: E3-1230 V3 散片 ¥1349

显卡: 技嘉 GV-N760OC-2GD ¥1699

主板: 技嘉 GA-B85M-DS3H ¥379

内存: 金士顿骇客神条 8G DDR3 ¥445

View _ide_helper.php
<?php
/**
* An helper file for Laravel 4, to provide autocomplete information to your IDE
* Generated for Laravel 4.2.8 on 2014-08-26.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@HugoPresents
HugoPresents / lnmp.sh
Last active Aug 29, 2015
install & configure php5 nginx on ubuntu
View lnmp.sh
#!/bin/bash
# install depends
apt-get update && apt-get install -y aria2 libxml2 libxml2-dev libssl-dev pkg-config curl libcurl4-nss-dev enchant libenchant-dev libjpeg8 libjpeg8-dev libpng12-0 libpng12-dev libvpx1 libvpx-dev libfreetype6 libfreetype6-dev libt1-5 libt1-dev libgmp10 libgmp-dev libicu-dev mcrypt libmcrypt4 libmcrypt-dev libpspell-dev libedit2 libedit-dev libsnmp-dev libxslt1.1 libxslt1-dev autoconf make g++ python-software-properties git redis-server
# download php & install
aria2c http://jp1.php.net/distributions/php-5.5.13.tar.gz
aria2c http://jaist.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/4.2.2/phpMyAdmin-4.2.2-all-languages.tar.gz
tar -xf phpMyAdmin-4.2.2-all-languages.tar.gz
mkdir /var/htdocs
mv phpMyAdmin-4.2.2-all-languages /var/htdocs/pma