Skip to content

Instantly share code, notes, and snippets.

View lokielse's full-sized avatar
🏠
Working from home

lokielse lokielse

🏠
Working from home
View GitHub Profile
@lokielse
lokielse / test.html
Created April 21, 2013 05:09
点击jpg变gif, click jpg to gif
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<img class="ws_img_click_big" src="http://ww3.sinaimg.cn/thumbnail/95b69a0ejw1e3tklwgwbyg.gif"
data-bigurl="http://ww3.sinaimg.cn/bmiddle/95b69a0ejw1e3tklwgwbyg.gif" width=150/>
<script type="text/javascript">
@lokielse
lokielse / iteration.php
Last active December 18, 2015 04:39
some iteration func
<?php
/**
* Created by sqiu.
* CreateTime: 13-6-6 下午7:18
*
*/
$src = array();
$src[] = array('A','B','C','D','E');
$src[] = array('+', '-', '*', '/');
@lokielse
lokielse / plist.php
Created November 1, 2013 17:28
php convert array to plist
<?PHP
/**
* PropertyList class
* Implements writing Apple Property List (.plist) XML and text files from an array.
*
* @author Jesus A. Alvarez <zydeco@namedfork.net>
*/
//====================================================demo
$json = '{"安徽":["合肥","安庆","蚌埠","亳州","巢湖","滁州","阜阳","贵池","淮北","淮化","淮南","黄山","九华山","六安","马鞍山","宿州","铜陵","屯溪","芜湖","宣城"],"北京":["东城","西城","崇文","宣武","朝阳","丰台","石景山","海淀","门头沟","房山","通州","顺义","昌平","大兴","平谷","怀柔","密云","延庆"],"重庆":["万州","涪陵","渝中","大渡口","江北","沙坪坝","九龙坡","南岸","北碚","万盛","双挢","渝北","巴南","黔江","长寿","綦江","潼南","铜梁","大足","荣昌","壁山","梁平","城口","丰都","垫江","武隆","忠县","开县","云阳","奉节","巫山","巫溪","石柱","秀山","酉阳","彭水","江津","合川","永川","南川"],"福建":["福州","福安","龙岩","南平","宁德","莆田","泉州","三明","邵武","石狮","晋江","永安","武夷山","厦门","漳州"],"甘肃":["兰州","白银","定西","敦煌","甘南","金昌","酒泉","临夏","平凉","天水","武都","武威","西峰","嘉峪关","张掖"],"广东":["广州","潮阳","潮州","澄海","东莞","佛山","河源","惠州","江门","揭阳","开平","茂名","梅州","清远","汕头","汕尾","韶关","深圳","顺德","阳江","英德","云浮","增城","湛江","肇庆","中山","珠海"],"广西":["南宁","百色","北海","桂林","防城港","河池","贺州","柳州","来宾","
@lokielse
lokielse / haproxy
Created August 31, 2014 07:15
HAProxy boot start init file
#!/bin/sh
# chkconfig 2345 on
# description: HAProxy is a TCP/HTTP reverse proxy which is particularly suited for high availability environments.
if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
. /etc/rc.d/init.d/functions
elif [ -f /lib/lsb/init-functions ] ; then
. /lib/lsb/init-functions
else
@lokielse
lokielse / proxy
Last active August 29, 2015 14:05
HAProxy boot start init file
### BEGIN INIT INFO
# Provides: lsws
# Required-Start: $local_fs [COLOR="Red"]$remote_fs $network[/COLOR]
# Required-Stop: $local_fs [COLOR="Red"]$remote_fs $network[/COLOR]
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: lshttpd
# Description: LiteSpeed Web Server is a World Wide Web server.
### END INIT INFO
@lokielse
lokielse / CCPRest.php
Last active December 1, 2015 14:41
容联-云通讯 PHP-SDK
<?php
/*
* Copyright (c) 2014 The CCP project authors. All Rights Reserved.
*
* Use of this source code is governed by a Beijing Speedtong Information Technology Co.,Ltd license
* that can be found in the LICENSE file in the root of the web site.
*
* http://www.yuntongxun.com
*
@lokielse
lokielse / TowerRest.php
Created January 26, 2015 13:05
Tower Rest API PHP SDK
<?php
/**
* Tower Rest API v1.0
* PHP SDK
*/
namespace Tower;
class TowerRest
{
//http://stackoverflow.com/a/24166645
//
#import <UIKit/UIKit.h>
typedef void (^UITableViewCellAutoLayoutRenderBlock)(void);
@interface UITableViewCell (AutoLayoutDynamicHeightCalculation)
/**
* Grab an instance of the receiving type to use in order to calculate AutoLayout contraint driven dynamic height. The method pulls the cell from a nib file and moves any Interface Builder defined contrainsts to the content view.
*
@lokielse
lokielse / 2016_01_01_200328_migrate_to_utf8mb4.php
Created January 2, 2016 07:49
Laravel migrate mysql database to utfmb4
<?php
use Illuminate\Database\Migrations\Migration;
class MigrateToUtf8mb4 extends Migration
{
public function up()
{
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
@lokielse
lokielse / letsencrypt.md
Created January 6, 2016 05:57 — forked from xrstf/letsencrypt.md
Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

Let's Encrypt on Ubuntu 14.04, nginx with webroot auth

This document details how I setup LE on my server. Firstly, install the client as described on http://letsencrypt.readthedocs.org/en/latest/using.html and make sure you can execute it. I put it in /root/letsencrypt.

As it is not possible to change the ports used for the standalone authenticator and I already have a nginx running on port 80/443, I opted to use the webroot method for each of my domains (note that LE does not issue wildcard certificates by design, so you probably want to get a cert for www.example.com and example.com).

Configuration

For this, I placed config files into etc/letsencrypt/configs, named after <domain>.conf. The files are simple: