Skip to content

Instantly share code, notes, and snippets.

View overtrue's full-sized avatar
🎯
Focusing

安正超 overtrue

🎯
Focusing
View GitHub Profile
@overtrue
overtrue / StringExtension.swift
Last active August 22, 2016 06:55
Swift Extensions
import Foundation
extension String {
var length: Int {
return (self as NSString).length
}
func split(separator: Character) -> [String] {
return self.characters.split { $0 == separator }.map(String.init)
}
<?php
var_dump(substr_count(file_get_contents('http://106.75.28.160/UCloud.txt'), 'UCanUup'));
// int(728)
# Install dependencies
#
# * checkinstall: package the .deb
# * libpcre3, libpcre3-dev: required for HTTP rewrite module
# * zlib1g zlib1g-dbg zlib1g-dev: required for HTTP gzip module
apt-get install checkinstall libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
# Compile against OpenSSL to enable NPN
#! /bin/bash
#
# nginx - this script starts and stops the nginx daemon
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
#
# processname: nginx
# config: /etc/nginx/nginx.conf
@overtrue
overtrue / 0_reuse_code.js
Last active September 4, 2016 04:54
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@overtrue
overtrue / packgist.conf
Last active September 4, 2016 04:54
小脚本与配置文件
# 缓存
proxy_cache_path /tmp/nginx/cache keys_zone=one:5m
loader_threshold=300 loader_files=2000;
server {
listen *:80; #换成你的IP地址
client_max_body_size 100M;
server_name YOUR_DOMAIN.COM; #换成你的域名
charset utf-8;
error_page 500 502 503 504 /50x.html;
@overtrue
overtrue / linux.md
Created May 8, 2015 03:21
问题集

sudo -Hu 执行时找不到命令

虽然在 /etc/profile 中加了全局 PATH,但是在以 sudo -Hu [username] [command] 执行的时候报命令不存在,原因是 /etc/sudoers 中还有一个 secure_path 没修改:

visudo

查找 secure_path,加入你要添加的目录,比如 /usr/local/bin:

@overtrue
overtrue / Kernel.php
Last active September 4, 2016 04:55
PHP Tips
<?php
namespace App\Http;
use Illuminate\Foundation\Http\Kernel as HttpKernel;
class Kernel extends HttpKernel {
/**
* The application's global HTTP middleware stack.
@overtrue
overtrue / sweetalert.util.js
Last active September 4, 2016 04:55
有用的js函数
var defaultTimer = 500000;
/**
* 成功消息
*
* @param {String} title
* @param {String} message
* @param {Integer} timer
*
* @return {boolean}
@overtrue
overtrue / atom-style.less
Last active September 4, 2016 04:55
Editor Settings
// style the background color of the tree view
* {
// background-color: whitesmoke;
font-size: 11px;
font-family:"PingFang SC", "Helvetica Neue", "Hiragino Sans GB","Microsoft YaHei","Hiragino Kaku Gothic Pro", Helvetica, arial, nimbussansl, liberationsans, freesans, clean, sans-serif;
}
// style the background and foreground colors on the atom-text-editor-element itself
atom-text-editor {