Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Deyong Zhu M2shad0w

🎯
Focusing
View GitHub Profile
View git 设置和取消代理
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@M2shad0w
M2shad0w / go-get-ip-from-request
Created Jun 11, 2018 — forked from johnsonz/go-get-ip-from-request
go从Request获取IP地址
View go-get-ip-from-request
func GetIPFromRequest(r *http.Request) string {
ip, _, err := net.SplitHostPort(r.RemoteAddr)
if err != nil {
glog.Errorf("userip: %q is not IP:port", r.RemoteAddr)
return ""
}
userIP := net.ParseIP(ip)
if userIP == nil {
glog.Errorf("userip: %q is not IP:port", r.RemoteAddr)
return ""
@M2shad0w
M2shad0w / wget-gdrive.sh
Created May 3, 2018 — forked from lvzongting/wget-gdrive.sh
download google drive file only with wget 仅通过wget 在bash命令行下载谷歌网盘(狗哥网盘)上的文件
View wget-gdrive.sh
#reference https://unix.stackexchange.com/questions/136371/how-to-download-a-folder-from-google-drive-using-terminal
#get cookie and code
wget --save-cookies cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=FILEID' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/Code: \1\n/p'
#download the file
wget --load-cookies cookies.txt 'https://docs.google.com/uc?export=download&confirm=CODE_FROM_ABOVE&id=FILEID'
@M2shad0w
M2shad0w / gist:b307dc28afd4b3ecc1e520ed74cd2c13
Created Feb 11, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:b307dc28afd4b3ecc1e520ed74cd2c13

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@M2shad0w
M2shad0w / tornado-nginx-example.conf
Created Aug 23, 2017 — forked from didip/tornado-nginx-example.conf
Nginx config example for Tornado
View tornado-nginx-example.conf
worker_processes 2;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
use epoll;
}
@M2shad0w
M2shad0w / go-get-progress.md
Created Jul 28, 2017 — forked from Jimmy-Xu/go-get-progress.md
go get支持显示进度条
View go-get-progress.md

修改 $GOROOT/src/cmd/go/vcs.go,作如下修改

// vcsGit describes how to use Git.
var vcsGit = &vcsCmd{
        name: "Git",
        cmd:  "git",

        createCmd:   []string{"clone --progress {repo} {dir}", "--git-dir={dir}/.git submodule update --init --recursive"},
        downloadCmd: []string{"pull --ff-only", "submodule update --init --recursive"},
View howto-design-an-api.md

如何设计一个API服务

By @notsobad

认证

api key

url中附加一个key

/api/posts/?key=aasd2323423asdfasdf
@M2shad0w
M2shad0w / HBaseNewAPI.scala
Created Aug 12, 2016 — forked from wuchong/HBaseNewAPI.scala
Spark 下 操作 HBase 1.0.0 新版API
View HBaseNewAPI.scala
import org.apache.hadoop.hbase.util.Bytes
import org.apache.hadoop.hbase.{HColumnDescriptor, HTableDescriptor, TableName, HBaseConfiguration}
import org.apache.hadoop.hbase.client._
import org.apache.spark.SparkContext
import scala.collection.JavaConversions._
/**
* HBase 1.0.0 新版API, CRUD 的基本操作代码示例
**/
object HBaseNewAPI {
@M2shad0w
M2shad0w / build.sbt
Created Jul 9, 2016 — forked from mumoshu/build.sbt
DES and AES encryption in Scala
View build.sbt
name := "DES and AES encryption in Scala"
version := "1.0"
scalaVersion := "2.9.1"
libraryDependencies += "commons-codec" % "commons-codec" % "1.6"
@M2shad0w
M2shad0w / zeppelin-emr-bootstrap-action.sh
Created May 27, 2016 — forked from snowindy/zeppelin-emr-bootstrap-action.sh
This is bootstrap action script for Amazon EMR helping installing Apache Zeppelin to work with Apache Spark. Works fine with [EMR Release label:emr-4.0.0 Hadoop distribution:Amazon 2.6.0 Applications:Hive 1.0.0, Spark 1.4.1]
View zeppelin-emr-bootstrap-action.sh
#!/bin/bash
#Zeppelin installation on Spark EMR cluster
sudo yum update -y
sudo yum install -y git
# Installing maven: https://gist.github.com/sebsto/19b99f1fa1f32cae5d00
sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo
sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo
sudo yum install -y apache-maven