Skip to content

Instantly share code, notes, and snippets.

压力很大同志 ipconfiger

Block or report user

Report or block ipconfiger

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View main.py
# coding=utf8
import os
import time
import request
from lxml import html
def get_page_url(pid):
if pid == 1:
View Power.py
#coding=utf8
import sys
import os
import time
import RPi.GPIO as GPIO
from fabric import SerialGroup as Group
GPIO.setmode(GPIO.BOARD)
GPIO.setup(40, GPIO.IN)
@ipconfiger
ipconfiger / 2048.py
Created Aug 2, 2019
2048Game In 92line Python code
View 2048.py
# coding=utf8
import sys
import os
import random
import itertools
def trim(seqs, direction=0):
return ([0, 0, 0, 0] + [n for n in seqs if n])[-4:] if direction else ([n for n in seqs if n]+[0, 0, 0, 0])[:4]
View html.js
class HtmlField extends React.Component {
constructor(props) {
super(props);
this.state = {
html: this.props.html,
validateResult: true,
validateStatus: "",
up_token: "",
up_file_key: ""
@ipconfiger
ipconfiger / gist:8376ee9b5f0eb4f3cef3e687f8d331f7
Last active Sep 6, 2017
一行代码转换数字字符串到大写, 比如 104 =>壹佰零肆
View gist:8376ee9b5f0eb4f3cef3e687f8d331f7
终极方法
lambda number_string: (lambda seq: "".join(reversed(["".join(["".join([p, ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"][int(n)], u]) for p, n, u in reversed(s[0])]) + s[1] for s in [(lambda sub_seq: [[["零", tp[0], tp[1]] if i<(len(sub_seq)-1) and int(sub_seq[i+1])< 1 else ["", tp[0], tp[1]] for i, tp in enumerate(zip(sub_seq, ["", "拾", "佰", "仟"])) if int(tp[0])], unit])(seq[idx*4:(idx+1)*4] or []) for idx, unit in enumerate(["", "万", "亿", "兆", "京"])] if s[0]])))("".join(reversed(str(number_string)))) or "零"
第一种方法
lambda seq:"".join(list(reversed([("%s%s" % (["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"][int(list(reversed(seq))[idx])], unit)) if idx>0 or int(list(reversed(seq))[1]) else ("零%s" % ["零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"][int(list(reversed(seq))[idx])]) for idx, unit in enumerate(reversed(reduce(list.__add__, [ ["仟", "佰", "拾", big_unit] for big_unit in ["兆", "亿", "万", ""]]))) if idx<len(seq) and int(list(reversed(seq))[idx])>0])))
@ipconfiger
ipconfiger / BaseModel.m
Created Jan 16, 2014
映射json反序列化的字典到自定义类型
View BaseModel.m
//
// BaseModle.m
// apitester
//
// Created by LiMing on 14-1-16.
// Copyright (c) 2014年 LiMing. All rights reserved.
//
#import "BaseModle.h"
#import <objc/message.h>
View get_member2.py
import requests
import datetime
from BeautifulSoup import BeautifulSoup
import random
import time
def get_page(url):
r=requests.get(url)
print url
return BeautifulSoup(r.text)
@ipconfiger
ipconfiger / fetch.js
Created Oct 10, 2013
获取QQ群成员的脚本
View fetch.js
function send_sync(qq,nick){
var xhr = new XMLHttpRequest();
xhr.open('POST', 'sync url', true);
xhr.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
xhr.onload = function () {
console.log(qq+"("+nick+") sync "+this.responseText);
};
xhr.send('qq='+qq+'&nick='+nick);
}
@ipconfiger
ipconfiger / sample_tor_app.py
Created Aug 7, 2013
a sample usage of torcast in tornado
View sample_tor_app.py
import tornado.ioloop
import tornado.web
from TorCast import client
class MainHandler(tornado.web.RequestHandler):
def get(self):
self.write("Hello, world")
application = tornado.web.Application([
(r"/", MainHandler),
You can’t perform that action at this time.