Skip to content

Instantly share code, notes, and snippets.

View cxfksword's full-sized avatar

cxfksword

  • China
  • 20:46 (UTC +08:00)
View GitHub Profile
@cxfksword
cxfksword / cmd.md
Last active April 8, 2017 09:34
windows命令行常用功能

获取当前执行bat的目录

echo %~dp0

进入执行bat目录

cd /d %~dp0
@cxfksword
cxfksword / vagrant_reset_ssh
Created January 26, 2015 03:29
vagrant ssh重置
默认vagrant私钥路径:
%userprofile%\.vagrant.d\insecure_private_key
当vagrant探测到是默认公钥时,vagrant up时会自动生成一个新的ssh key:
查看vagrant私钥路径:
λ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 2222
@cxfksword
cxfksword / file_get_contents.java
Last active June 1, 2017 20:36
java's file_get_contents()
// System.out.println(URLEncoder.encode(getFileContent("d:/1.jpg"), "ISO-8859-1"));
public static String getFileContent(String filePath) {
try {
File file = new File(filePath);
byte bt[] = new byte[(int)file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(bt);
fis.close();
#!/bin/bash
echo ""
echo -e "/*********************************************************"
echo -e " * 注意:执行前需要先安装git git-svn subversion *"
echo -e " * 如 apt-get install git git-svn subversion *"
echo -e " * \x1b[93m原git内容会被强制清空,清注意\x1b[0m *"
echo -e " *********************************************************/"
@cxfksword
cxfksword / check_git.sh
Created April 29, 2016 04:36
check git update
#!/bin/bash
if git status -uno|grep -q behind; then echo "ddd"; else echo "no"; fi
@cxfksword
cxfksword / curl.sh
Created September 2, 2016 16:51
curl alias
curl -o /dev/null -s -w \
" http_code: %{http_code}
time_namelookup: %{time_namelookup}
time_connect: %{time_connect}
time_appconnect: %{time_appconnect}
time_pretransfer: %{time_pretransfer}
time_starttransfer: %{time_starttransfer}
time_total: %{time_total}
size_request: %{size_request}
size_download: %{size_download}
@cxfksword
cxfksword / nginx_block.conf
Created September 9, 2016 06:52
nginx屏蔽除指定后缀文件访问
location ~ .*\.(?!gif|jpg|jpeg|png|bmp|swf|flv|ico|js|css|ttf|woff|html|htm|php)[^.]+$
return 404;
}
@cxfksword
cxfksword / nginx_https_crt.sh
Created October 8, 2016 04:18
生成nginx使用https证书
#!/bin/sh
# create self-signed server certificate:
read -p "Enter your domain [www.example.com]: " DOMAIN
echo "Create server key..."
openssl genrsa -des3 -out $DOMAIN.key 1024
@cxfksword
cxfksword / git_proxy.md
Created December 25, 2016 10:34
git设置代理

#http

git config --global http.proxy http://127.0.0.1:1080
git config --global https.proxy http://127.0.0.1:1080

#socket5

git config --global http.proxy socks5://127.0.0.1:1080
@cxfksword
cxfksword / npm.md
Last active January 5, 2017 07:10
npm在windows下避免目录多层嵌套的方法

1、安装npm 3以上版本,或nodejs 6以上

2、配置镜像使用淘宝

npm set registry https://registry.npm.taobao.org

3、直接使用npm install