Skip to content

Instantly share code, notes, and snippets.

View selfboot's full-sized avatar
🎯
Focusing

selfboot selfboot

🎯
Focusing
View GitHub Profile
@selfboot
selfboot / sendMail.py
Created March 21, 2017 11:34
Python 简单发送邮件
#! /usr/local/bin/python
SMTPserver = 'smtp.sina.com'
sender = '<[email protected]>'
destination = ['[email protected]']
USERNAME = "[email protected]"
PASSWORD = "*******"
# typical values for text_subtype are plain, html, xml
@selfboot
selfboot / getlinks.sh
Created March 17, 2017 02:31
获取优酷视频列表中所有视频播放链接
@selfboot
selfboot / gitconfig
Last active March 9, 2017 03:52
git 配置文件
[user]
name = xuelangZF
email = [email protected]
[core]
excludesfile = /Users/feizhao/.gitignore_global
editor = vim
quotepath = false
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
@selfboot
selfboot / ximalaya.js
Created February 27, 2017 05:44
喜马拉雅专辑中的音频下载脚本:浏览器控制台运行下面代码,即可得到当前页面中的音频下载链接。然后在命令行下载即可
$(".album_soundlist ul li").each(function(i){
var sound_id = $(this).attr("sound_id");
var json_url = "http://www.ximalaya.com/tracks/" + sound_id + ".json";
$.get(json_url,function(json){
var save_name = json.nickname + "-" + json.title + ".m4a";
var down_cmd = "wget " + json.play_path_64 + " -O " + save_name
console.log(down_cmd);
})
})
@selfboot
selfboot / combine.sh
Created October 25, 2016 02:14
软件著作权代码格式处理(需要在项目的根目录运行)
#! /usr/bin/env sh
# Find all the src file in your project
py_files=`find . -name '*.py'`
html_files=`find . -name '*.html'`
css_files=`find . -name '*.css'`
for i in $py_files
do
filename=$(basename "$i")
@selfboot
selfboot / surge.conf
Created August 27, 2016 01:24
比较不错的配置文件
# 规则配置仅供参考,适用于 Surge iOS & Mac;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计
# 屏蔽部分运营商劫持网页弹出流量统计
# 部分特性可能仅适用于最新的 TestFlight 版本
# 参数说明 zhHans.conf.ini http://bit.ly/29kwXlZ
# https://gist.githubusercontent.com/scomper/915b04a974f9e11952babfd0bbb241a8/raw/surge.conf
[General]
# warning, notify, info, verbose
loglevel = notify
# 你可以从该 URL 下载这个配置文件: http://surge.run/config-example/ios.conf
# 用编辑器编辑后,再通过 iTunes, URL, AirDrop 或者 iCloud Drive 复制回 iOS 设备
# Version 2.0
[General]
# 日志等级: warning, notify, info, verbose (默认值: notify)
loglevel = notify
# 跳过某个域名或者 IP 段,这些目标主机将不会由 Surge Proxy 处理。(在 macOS
# 版本中,如果启用了 Set as System Proxy, 那么这些值会被写入到系统网络代理
# 设置中.)
@selfboot
selfboot / scroll_toc.js
Last active August 27, 2016 01:19
目录滑动悬浮
$(function() {
var fix = $('#toc'); //滚动悬浮块
var fixTop = fix.offset().top, //滚动悬浮块与顶部的距离
fixHeight = fix.height(); //滚动悬浮块高度
$(window).scroll(function() {
$(":header").each(function() {
var id = $(this).attr('id');
// 跳过标题
if (typeof id != 'undefined'){
@selfboot
selfboot / Google_apac_2017_1_A.cpp
Created August 22, 2016 00:34
The Constitution of a certain country states that the leader is the person with the name containing the greatest number of different alphabet letters. (The country uses the uppercase English alphabet from A through Z.) For example, the name GOOGLE has four different alphabet letters: E, G, L, and O. The name APAC CODE JAM has eight different let…
#include <iostream>
#include <fstream>
#include <cmath>
#include <vector>
#include <algorithm>
using namespace std;
//ifstream in_file("/Users/feizhao/Desktop/A-small-practice.in");
ifstream in_file("/Users/feizhao/Desktop/A-large-practice.in");
//ifstream in_file("/Users/feizhao/Desktop/demo.in");
@selfboot
selfboot / simple_server.py
Created August 7, 2016 03:27
实现了 WSGI 的简单 Web 服务器。
# Tested with Python 2.7.9, Linux & Mac OS X
import socket
import StringIO
import sys
class WSGIServer(object):
address_family = socket.AF_INET
socket_type = socket.SOCK_STREAM