Skip to content

Instantly share code, notes, and snippets.

View pandada8's full-sized avatar
🐟
摸鱼

pandada8 pandada8

🐟
摸鱼
View GitHub Profile
@pandada8
pandada8 / gist:6200455
Created August 10, 2013 13:32
A Dnspod DDNS Update shell, Python Version
import requests
import socket
import time
socket.setdefaulttimeout(10)
TIMEOUT=60
params = {
"login_email"="yourname@example.com",
"login_password"="yourpassword",
"format"="json",
@pandada8
pandada8 / multi.py
Last active December 24, 2015 11:09
A Python Script used to parse Baidu Music. Poor HC Design. the output is the input file of the aria2c. If you want to use other tools ,Change the code yourself :)
import threading
import queue
import sys
import requests
import json
import re
from bs4 import BeautifulSoup as bs
class multidown(object):
def __init__(self,data,method=None):
self.data = queue.Queue()
@pandada8
pandada8 / 163.py
Last active August 29, 2015 13:56
163 Open Course downloader
#!/usr/bin/env python3
import requests
from bs4 import BeautifulSoup as bs
import re
import xmlrpc.client
import sys
import xml.etree.ElementTree as et
"""
Usage: python 163.py <url of the content>
@pandada8
pandada8 / bencode.py
Last active August 29, 2015 14:03
Bencode Decode
# Here c refer to content ,p refer to the pointer
# or the length of parsed text
DEBUG = True
decode_func = {}
def print_debug(fn):
def wrapper(c,p):
if DEBUG:
print(fn.__name__)
@pandada8
pandada8 / itebooks.py
Created October 26, 2014 05:20
it-ebooks.info
import sys
import requests
from bs4 import BeautifulSoup
import sys
import time
import concurrent.futures
import random
import json
import os
import re
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
body{
margin:0;
}
.wrapper{
margin: auto;
@pandada8
pandada8 / gist:970530d640183942fc72
Created December 2, 2014 13:49
国内Git托管服务简评

Gitcafe

  • 私有Repo需要付费
  • 私有协作需要付费
  • 托管空间512MB
  • 300K - 500K
  • 工单 & Wiki
  • Pages 服务

git@osc

@pandada8
pandada8 / tornado.py
Last active August 29, 2015 14:13
Tornado snippet for serve static file
class Redirector(StaticFileHandler):
def initialize(self, path, default_filename=None):
root, self.filename = os.path.split(path)
super(Redirector, self).initialize(root)
@coroutine
def get(self, include_body=True):
yield super(RedirectStaticFileHandler, self).get(self.filename, include_body)
@pandada8
pandada8 / client.bash
Last active August 29, 2015 14:14
Test your net.ipv4.tcp_congestion_control config with iperf
algos=$(find /lib/modules/`uname -r` -type f -name "*.ko" | sed -n "s/.*ipv4\/tcp_\(\w*\)\..*/\1/p" | sort -u)
server="XXX.XXX.XX.XXX"
filesize="10M"
for i in $algos
do
echo "Test $i";
sudo modprobe tcp_$i;
for t in {1..3}
do
@pandada8
pandada8 / basemodel.py
Last active August 29, 2015 14:15
Peewee snippet
from peewee import Model
from playhouse.db_url import connect
db = connect(os.env.get('DATABASE') or options.database)
class BaseModel(Model):
@classmethod
def try_get(cls, **kwargs):