Skip to content

Instantly share code, notes, and snippets.

View selfboot's full-sized avatar
🎯
Focusing

selfboot selfboot

🎯
Focusing
View GitHub Profile
@selfboot
selfboot / aprilFools.css
Last active December 19, 2015 03:21
win下修改chrome和360浏览器6.0版本的Custom.css,恶搞网页。 setup.py 为 py2exe的转换脚本。
/* HTML PRIDE! */
html {
-webkit-animation: rainbow 8s infinite;
}
/*
Spin all images
*/
img {
-webkit-animation: spin 1s linear infinite;
@selfboot
selfboot / chardet_test.py
Last active December 15, 2015 17:39
python 编码检测示例程序.
>>> import requests
>>> r = requests.get('http://www.luoo.net/radio/radio2/mp3player.xml')
>>> r.status_code
200
>>> print r.content
??xml version="1.0" encoding="UTF-8"?>
<player showDisplay="yes" showPlaylist="yes" autoStart="yes">
<song path="http://ftp.luoo.net/radio/radio2/1.mp3" title="鏃呰€? />
<song path="http://ftp.luoo.net/radio/radio2/2.mp3" title="潪浜? />
<song path="http://ftp.luoo.net/radio/radio2/3.mp3" title="涓夊嘲" />
@selfboot
selfboot / complete-dict
Created April 3, 2013 10:45 — forked from ntavish/complete-dict
python关键字自动补全字典
--- complete-dict - Created by Ryan Kulla using Python 2.6 on Ubuntu Linux 9.04 on July 23rd 2009 ---
--- Python Keywords (These were manually inputted) ---
and
del
for
is
raise
assert
elif
@selfboot
selfboot / redirect.c
Created April 13, 2013 07:36
判断stdout是否被重定向..
重定向:
zsh➜ $ ./file.o
before redirect...
zsh➜ $ cat demo
after redirect...
Redirected
@selfboot
selfboot / gist:5403358
Created April 17, 2013 10:45
mac wget 安装
下载Wget的源代码,下载地址:http://ftp.gnu.org/gnu/wget/
直接安装的话,会发生下面的错误。
checking for compress in -lz... yes
checking for gpg_err_init in -lgpg-error... no
checking for gcry_control in -lgcrypt... no
checking for libgnutls... no
configure: error: --with-ssl was given, but GNUTLS is not available.
解决:
@selfboot
selfboot / weather.py
Created April 18, 2013 09:52
weather.py: 获取天气信息,默认显示南阳新乡天气,可以在脚本后面加参数指定特定地点的天气。
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import sys
CITY_RECORD = {
# 直辖市
"北京": "101010100", "上海": "101020100",
"天津": "101030100", "重庆": "101040100",
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from bs4 import BeautifulSoup
import requests
import eyed3
import re
import urllib
import os
@selfboot
selfboot / download_ted.py
Created May 19, 2013 15:28
TED 视频下载: 获取指定标签下的所有带英文字幕的视频的下载url,然后用`curl -L -C - -O url`下载视频。
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import re
keywords_pattern = re.compile(r".*/([^.]+).mp4*")
subtitles_url_pattern = re.compile(r'<option value="en">English</option>')
base_url = "http://www.ted.com"
@selfboot
selfboot / ntfs_mount.py
Last active November 25, 2021 14:10
mac os x:自动挂载ntfs硬盘为读写权限。 只要ntfs硬盘连接到电脑即可使用 ./ntfs_mount_auto.py 挂载ntfs磁盘为可读写,ntfs_unmount.py 为卸载磁盘。 ntfs_mount.py 是较早的版本,只有电脑先识别除硬盘,在/Volumes 可读到硬盘内容时才可以使用此脚本挂载为可读写。 建议使用./ntfs_mount_auto.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import re
ntfs_pattern = re.compile(r'File System Personality: NTFS')
ntfs_device_node = re.compile(r'.*Device Node:.*')
device_dict = {}
@selfboot
selfboot / v2ex_auto.py
Created May 21, 2013 11:35
V2EX 自动领取奖励脚本:延迟一秒领取奖励(服务器检测速度判定是否是程序领取奖励)
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import requests
import time
from bs4 import BeautifulSoup
signin_url = "http://www.v2ex.com/signin"
award_url = "http://www.v2ex.com/mission/daily"
main_url = "http://www.v2ex.com"