Skip to content

Instantly share code, notes, and snippets.

View panw3i's full-sized avatar
🌴
On vacation

panw3i panw3i

🌴
On vacation
View GitHub Profile
@panw3i
panw3i / download-file.js
Created March 4, 2019 14:36 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);
@panw3i
panw3i / AnimatedToTop.html
Created October 12, 2018 09:14 — forked from foru17/AnimatedToTop.html
原生JS返回顶部动画
<div it="gotop"> </div>
<script>
backTop = function (btnId){
var btn = document.getElementById(btnId);
var d = document.documentElement;
var b = document.body;
window.onscroll = btnDisplay;
btn.onclick = function (){
btn.style.display = "none";
window.onscroll = null;
@panw3i
panw3i / find-in-json.js
Created March 7, 2018 13:13 — forked from iwek/find-in-json.js
Searching through JSON
//return an array of objects according to key, value, or key and value matching
function getObjects(obj, key, val) {
var objects = [];
for (var i in obj) {
if (!obj.hasOwnProperty(i)) continue;
if (typeof obj[i] == 'object') {
objects = objects.concat(getObjects(obj[i], key, val));
} else
//if key matches and value matches or if key matches and value is not passed (eliminating the case where key matches but passed value does not)
if (i == key && obj[i] == val || i == key && val == '') { //
alias showusers='cut -d: -f1 /etc/passwd'
alias showversion='lsb_release -a'
alias lr='ls -R | grep ":$" | sed -e '\''s/:$//'\'' -e '\''s/[^-][^\/]*\//--/g'\'' -e '\''s/^/ /'\'' -e '\''s/-/|/'\'''
alias gst="git status -sb"
alias grmmergedbranch='git branch --merged | grep -v "\*" | grep -v master | grep -v dev | xargs -n 1 git branch -d'
alias gll="git pull ; git submodule update"
alias grc="git rebase --continue"
alias glog="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- | less"
alias ga="git add"
alias gc="git commit -v"
if &compatible
set nocompatible
endif
set hidden
set noautochdir
set shortmess=a
set autowriteall
filetype plugin indent on
@panw3i
panw3i / emojis.json
Created January 5, 2018 06:10 — forked from oliveratgithub/emojis.json
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family_mothers_two_girls", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family_mothers_children", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family_mothers_two_boys", "shortname": "", "unicode": "", "html": "&#128105;&zwj;&#128105;&zwj;&#128102;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family_two_girls", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128103;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👧‍👦", "name": "family_children", "shortname": "", "unicode": "", "html": "&#128104;&zwj;&#128105;&zwj;&#128103;&zwj;&#128102;", "category": "p", "order": ""},
{"emoji": "👨‍👩‍👦‍👦", "name": "family_two_boys", "shortname": "", "unicode": "", "html": "&#128104;&zw
@panw3i
panw3i / baidu_yuyin.py
Created August 1, 2017 12:39 — forked from lhysrc/baidu_yuyin.py
百度语音API,包括语音转换和语音识别。
#coding:utf-8
TEXT = "垂死病中惊坐起,笑问客从何处来" # 要转换成语音的文字
AUDIO_FILE = "./f.wav" # 要识别的语音文件
cuid = 'py'
apiKey = "..."
secretKey = "..."
auth_url = "https://openapi.baidu.com/oauth/2.0/token?grant_type=client_credentials&client_id="\
+ apiKey + "&client_secret=" + secretKey
import urllib2
@panw3i
panw3i / centos6.5_nginx
Created June 30, 2017 13:17 — forked from ifels/centos6.5_nginx
centos 6.5 nginx安装与配置
第一步,在/etc/yum.repos.d/目录下创建一个源配置文件nginx.repo:
cd /etc/yum.repos.d/
vim nginx.repo
填写如下内容:
[nginx]
name=nginx repo
@panw3i
panw3i / 0_reuse_code.js
Created April 16, 2017 05:55
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@panw3i
panw3i / update_gfwlist.sh
Created January 28, 2017 10:41 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)