Skip to content

Instantly share code, notes, and snippets.

View z2015's full-sized avatar
🎯
Focusing

William Zhou z2015

🎯
Focusing
View GitHub Profile
@z2015
z2015 / functions.php
Created May 2, 2016 02:22
WordPress上传Apk文件到媒体库
function add_upload_mime_types( $mimes ) {
if ( function_exists( 'current_user_can' ) )
$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
if ( !empty( $unfiltered ) ) {
$mimes['apk'] = 'application/vnd.android.package-archive';
}
return $mimes;
}
add_filter( 'upload_mimes', 'add_upload_mime_types' );
@z2015
z2015 / index.html
Created May 2, 2016 02:24
Ubuntu 14.04安装Linux, nginx, MySQL, PHP (LEMP)
<!--https://www.digitalocean.com/community/tutorials/how-to-install-linux-nginx-mysql-php-lemp-stack-on-ubuntu-14-04-->
@z2015
z2015 / app.js
Created May 2, 2016 02:26
使用javascript禁止鼠标滚动页面(包括键盘方向键)
// left: 37, up: 38, right: 39, down: 40,
// spacebar: 32, pageup: 33, pagedown: 34, end: 35, home: 36
var keys = {
37: 1,
38: 1,
39: 1,
40: 1
};
function preventDefault(e) {
@z2015
z2015 / index.html
Created May 2, 2016 02:31
网页flash动画html设置成透明的方法
<EMBED height=60 pluginspage=http://www.macromedia.com/go/getflashplayer src=http://www.jb51.net/flash/flash.swf type=application/x-shockwave-flash width=468 wmode="transparent" quality="high"></EMBED>
@z2015
z2015 / mysql.sql
Created May 2, 2016 02:32
mysql备份还原操作命令
mysqldump -u username -p database_to_backup > backup_name.sql
mysql -u username -p
CREATE DATABASE database_name;
exit
mysql -u username -p database_name < backup_name.sql
//https://www.digitalocean.com/community/tutorials/how-to-backup-mysql-databases-on-an-ubuntu-vps
@z2015
z2015 / ngnix.conf
Created May 2, 2016 02:32
nginx配置https://证书以及http访问实现301跳转到https://
server{
listen 443 ssl;
server_name www.mydomain.com;
root /www/mydomain.com/;
ssl on;
ssl_certificate /ssl/domain.crt;
ssl_certificate /ssl/domain.key;
.
.
@z2015
z2015 / django.py
Created May 2, 2016 02:34
Virtualenv搭建python3环境并安装djangoproject
sudo pip install virtualenv
sudo apt-get install python3
virtualenv --no-site-packages --python=python3.4 test_env
如果出现The executable python does not exist 错误,那么可以这样使用
virtualenv --no-site-packages --python=3.4 test_env
source test_env/bin/activate
pip install django
@z2015
z2015 / chrome.sh
Created May 2, 2016 02:35
Ubuntu Kylin自带chromium浏览器安装flashplayer插件
sudo apt-get update
sudo apt-get install chromium-browser
sudo apt-get install pepperflashplugin-nonfree
sudo update-pepperflashplugin-nonfree --install
sudo apt-get remove chromium-browser pepperflashplugin-nonfree
@z2015
z2015 / github.sh
Created May 2, 2016 02:36
移除之前github上不小心提交的敏感信息
git filter-branch --force --index-filter \
'git rm --cached --ignore-unmatch Rakefile' \
--prune-empty --tag-name-filter cat -- --all
Rewrite 48dc599c80e20527ed902928085e7861e6b3cbe6 (266/266)
Ref 'refs/heads/master' was rewritten
echo "Rakefile" >> .gitignore
git add .gitignore
git commit -m "Add Rakefile to .gitignore"
@z2015
z2015 / github.sh
Created May 2, 2016 02:38
git推送本地文件到github仓库初始化
git init
git add .
# Adds the files in the local repository and stages them for commit. To unstage a file, use 'git reset HEAD YOUR-FILE'.
git commit -m "First commit"
# Commits the tracked changes and prepares them to be pushed to a remote repository. To remove this commit and modify the file, use 'git reset --soft HEAD~1' and commit and add the file again.
git remote add origin remote repository URL
# Sets the new remote