Skip to content

Instantly share code, notes, and snippets.

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

Yi Ma my3157

🏠
Working from home
View GitHub Profile
@my3157
my3157 / keys.go
Created August 31, 2017 15:27 — forked from sdorra/keys.go
Golang RSA Key Generation
/*
* Genarate rsa keys.
*/
package main
import (
"crypto/rand"
"crypto/rsa"
"crypto/x509"
@my3157
my3157 / nginx-error-page
Created June 6, 2017 06:09 — forked from simlegate/custom-error-page
Nginx return custom json
error_page 400 404 405 =200 @40*_json;
location @40*_json {
default_type application/json;
return 200 '{"code":"1", "message": "Not Found"}';
}
error_page 500 502 503 504 =200 @50*_json;
location @50*_json {
@my3157
my3157 / Program.cs
Created May 19, 2017 07:11
dot core exec linux command
using System;
using System.Diagnostics;
namespace cmd
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("command:");
var command = Console.ReadLine();
@my3157
my3157 / cmd-exec-shell-pipeline.go
Created April 7, 2017 06:11
cmd-exec-shell-pipeline
package main
import (
"os"
"os/exec"
)
func main() {
cmd := exec.Command("/bin/sh", "-c", `ps -eaf|grep "nginx: master"|grep -v "grep"|awk '{print $2}'`)
cmd.Stdout = os.Stdout
@my3157
my3157 / dump_http_request.go
Created March 31, 2017 11:17
dump http request
package main
import (
"fmt"
"log"
"net/http"
"net/http/httputil"
"strings"
)
@my3157
my3157 / negroni_denco.go
Last active March 30, 2017 08:35
negroni_denco.go
package main
import (
"fmt"
"net/http"
"github.com/naoina/denco"
"github.com/urfave/negroni"
)
@my3157
my3157 / negroni_httprouter.go
Last active March 30, 2017 08:39 — forked from jakejscott/server.go
negroni + httprouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/julienschmidt/httprouter"
"net/http"
)
func main() {
// Copyright 2009 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// Generate a self-signed X.509 certificate for a TLS server. Outputs to
// 'cert.pem' and 'key.pem' and will overwrite existing files.
package main
import (
@my3157
my3157 / go-ssh-terminal.go
Created January 6, 2017 09:01
go ssh terminal
package main
import (
"fmt"
"io/ioutil"
"os"
"golang.org/x/crypto/ssh"
)
@my3157
my3157 / Xcode 文件下载.md
Created December 13, 2016 08:42 — forked from mr-pinzhang/Xcode 文件下载.md
Xcode 文件下载

在 Xcode 里下载文件真的是一种折磨, 特别是每次 Xcode 大版本更新都会遇到新的下载内容. 经过一翻周折, 本人找到一个方法可以轻松快速便捷地下载和安装对应的 Simulator 和 Doc 文件

  1. 在 Mac 下, 打开 Xcode, 进入 Preference 中的 Downloads 面板
  2. 点击任意的下载按钮
  3. 打开系统帮助工具 Console
  4. 稍等一会儿, 在 Xcode 里取消下载, 然后你会在 Console 里面看到对应的下载地址 (对应的 Cosnole Message 是 (DVTDownloadable: Download Cancelled. Downloadable: ...) 之类的)
  5. 复制对应的链接地址, 到某雷或者任何比 Xcode 下载快的工具里
  6. 等待下载完成, 进入 /Users/#{Username}/Library/Caches