Skip to content

Instantly share code, notes, and snippets.

View overtrue's full-sized avatar
🎯
Focusing

安正超 overtrue

🎯
Focusing
View GitHub Profile
@overtrue
overtrue / init.fish
Last active December 6, 2023 05:24 — forked from alyssaq/config.fish
config.fish set environment variables from bash_profile
# Fish shell
egrep "^export " ~/.bash_profile | while read e
set var (echo $e | sed -E "s/^export ([A-Za-z_]+)=(.*)\$/\1/")
set value (echo $e | sed -E "s/^export ([A-Za-z_]+)=(.*)\$/\2/")
# remove surrounding quotes if existing
set value (echo $value | sed -E "s/^\"(.*)\"\$/\1/")
if test $var = "PATH"
#! /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 / 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)
}
JPEG2000 image files,00 00 00 0C 6A 50 20 20,JP2,Picture
3GPP multimedia files,00 00 00 14 66 74 79 70,3GP,Multimedia
MPEG-4 v1,00 00 00 14 66 74 79 70 69 73 6F 6D,MP4,Multimedia
3rd Generation Partnership Project 3GPP,00 00 00 14 66 74 79 70,3GG|3GP|3G2,Multimedia
Windows Disk Image,00 00 00 00 14 00 00 00,TBI,Windows
MPEG-4 video_1,00 00 00 18 66 74 79 70,3GP5|M4V|MP4,Multimedia
MPEG-4 video_2,00 00 00 1C 66 74 79 70,MP4,Multimedia
3GPP2 multimedia files,00 00 00 20 66 74 79 70,3GP,Multimedia
Apple audio and video,00 00 00 20 66 74 79 70 4D 34 41,M4A,Multimedia
3rd Generation Partnership Project 3GPP2,00 00 00 20 66 74 79 70,3GG|3GP|3G2,Multimedia
# 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
@overtrue
overtrue / .gitignore
Created May 31, 2016 12:00
global gitignore
# 设置方法:
# git config --global core.excludesfile ~/.gitignore_global
#compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
<?php
var_dump(substr_count(file_get_contents('http://106.75.28.160/UCloud.txt'), 'UCanUup'));
// int(728)
@overtrue
overtrue / Preferences.sublime-settings
Last active February 16, 2019 08:11
Sublime Setting
{
"always_show_minimap_viewport": true,
"atomic_save": true,
"binary_file_patterns":
[
"*.jpg",
"*.jpeg",
"*.png",
"*.gif",
"*.ttf",
@overtrue
overtrue / date-preg-match.php
Last active April 1, 2019 17:40
匹配文本中的日期部分
<?php
$cases = [
'明年,1月1日下午2:30,test',
'二零一七年,1月1日下午2:30,test',
'今年,12月1日下午2:30,test',
'嘎嘎嘎,1月1日下午2:30,test',
'2016年,1月1日下午2:30,test',
'20161月1日下午2:30,test',
'20161月1日上午2:30,test',
@overtrue
overtrue / pkg.youdomain.com.conf
Created February 17, 2017 09:27
Packagist proxy template for nginx vhost.
proxy_cache_path /tmp/nginx/cache keys_zone=one:200m
loader_threshold=300 loader_files=2000;
server {
listen *:80;
client_max_body_size 100M;
server_name pkg.yourdomain.com; # YOUR HOST
charset utf-8;
location / {
proxy_cache one;