Skip to content

Instantly share code, notes, and snippets.

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

郭华伟 nosun

🏠
Working from home
View GitHub Profile
@nosun
nosun / md-menu.html
Last active August 29, 2015 14:08 — forked from cloudsben/md-menu.html
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function(){
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;
#! /bin/sed -f
## Markdown2Dokuwiki - reformat Markdown to Dokuwiki
## Copyright (C) 2012 Matous J. Fialka, <http://mjf.cz/>
## Released under the terms of The MIT License
## TODO: many things yet...
# reformatovani nadpisu
s/^#####/==/
<?php
/**
* An helper file for Laravel 5, to provide autocomplete information to your IDE
* Generated for Laravel 5.0.16 on 2015-03-16.
*
* @author Barry vd. Heuvel <barryvdh@gmail.com>
* @see https://github.com/barryvdh/laravel-ide-helper
*/
namespace {
@nosun
nosun / PhpStorm Keyboard Shortcuts.md
Created June 25, 2016 09:41 — forked from koomai/PhpStorm Keyboard Shortcuts.md
Frequently Used PhpStorm Keyboard Shortcuts

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).

@nosun
nosun / answer_pic.go
Created April 14, 2017 03:40 — forked from tetsuok/answer_pic.go
An answer of the exercise: Slices on a tour of Go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
// Allocate two-dimensioanl array.
a := make([][]uint8, dy)
for i := 0; i < dy; i++ {
a[i] = make([]uint8, dx)
}
@nosun
nosun / fibonacci_closure.go
Created April 14, 2017 07:56 — forked from tetsuok/fibonacci_closure.go
An answer of the exercise: Fibonacci closure on a tour of Go
package main
import "fmt"
// Very naive answer.
// fibonacci is a function that returns
// a function that returns an int.
func fibonacci() func() int {
n := 0
a := 0
@nosun
nosun / exercise.tour.go
Created April 14, 2017 09:22 — forked from zyxar/exercise.tour.go
tour.golang exercise solutions
/* Exercise: Loops and Functions #43 */
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
z := float64(2.)
@nosun
nosun / weixin.md
Created May 9, 2017 07:12 — forked from Josscii/weixin.md
wechat_spider 原理扫盲帖

wechat_spider 原理扫盲帖

这篇文章旨在为刚接触 wechat_spider 的人提供一个快速了解这个项目基本原理的途径。

思路

首先我们随便进入一个微信公众号详情页。

@nosun
nosun / logstash-grok-pattern
Last active August 15, 2017 03:50
logstash-grok-pattern
USERNAME [a-zA-Z0-9._-]+
USER %{USERNAME}
EMAILLOCALPART [a-zA-Z][a-zA-Z0-9_.+-=:]+
EMAILADDRESS %{EMAILLOCALPART}@%{HOSTNAME}
INT (?:[+-]?(?:[0-9]+))
BASE10NUM (?<![0-9.+-])(?>[+-]?(?:(?:[0-9]+(?:\.[0-9]+)?)|(?:\.[0-9]+)))
NUMBER (?:%{BASE10NUM})
BASE16NUM (?<![0-9A-Fa-f])(?:[+-]?(?:0x)?(?:[0-9A-Fa-f]+))
BASE16FLOAT \b(?<![0-9A-Fa-f.])(?:[+-]?(?:0x)?(?:(?:[0-9A-Fa-f]+(?:\.[0-9A-Fa-f]*)?)|(?:\.[0-9A-Fa-f]+)))\b
@nosun
nosun / api.example.net.conf
Created August 22, 2017 06:52 — forked from mrluanma/api.example.net.conf
cache POST request with Nginx
upstream api_example_net {
server api.example.net:4000;
keepalive 600;
}
proxy_cache_path /var/cache/nginx/tag levels=1:2 keys_zone=tag:10m inactive=1d max_size=10g;
server {
listen 80;
server_name api.example.net;