This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | |
<title>四数推理</title> | |
<style> | |
* { | |
font-size: 30px; | |
font-family: monospace; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# lunar.py | |
# 2015/02/27 罗兵 | |
import datetime | |
class Lunar(object): | |
#****************************************************************************** | |
# 下面为阴历计算所需的数据,为节省存储空间,所以采用下面比较变态的存储方法. | |
#****************************************************************************** | |
#数组g_lunar_month_day存入阴历1901年到2050年每年中的月天数信息, | |
#阴历每月只能是29或30天,一年用12(或13)个二进制位表示,对应位为1表30天,否则为29天 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python2.7 | |
# pip intall pynput | |
from pynput import mouse | |
from pynput import keyboard | |
from pynput.mouse import Button | |
from pynput.keyboard import Key, KeyCode | |
import time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rc4(data, key) { | |
var box = Array(256) | |
for (var i = 0; i < 256; i++) { | |
box[i] = i | |
} | |
var x = 0 | |
for (var i = 0; i < 256; i++) { | |
x = (x + box[i] + key.charCodeAt(i % key.length)) % 256 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"os" | |
"net" | |
"github.com/Shopify/sarama" | |
) | |
var port = "10086" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cassandra.cluster import Cluster | |
from cassandra.query import SimpleStatement | |
cluster = Cluster(['taojy123.com']) | |
session = cluster.connect('taiqiyun') | |
query = "SELECT * FROM best" | |
statement = SimpleStatement(query, fetch_size=2) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- ! =============== 通用方法 ================== | |
func daily(table_name): | |
-- 每日统计加上周统计日字段 | |
( | |
SELECT | |
*, | |
CASE WHEN date_format(date(`日期`),'%w') < 5 | |
THEN subdate(date(`日期`), date_format(date(`日期`),'%w') -4 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from sys import version_info | |
from base64 import b64encode, b64decode | |
from binascii import hexlify, unhexlify | |
__all__ = ['encrypt_ecb', 'decrypt_ecb', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sqlalchemy | |
from sqlalchemy import Column, Integer, String | |
from sqlalchemy.ext.declarative import declarative_base | |
import pymysql | |
pymysql.install_as_MySQLdb() | |
#object(oop) ---> mysql(SQL) | |
#1). 创建数据库引擎(连接数据库的过程) | |
#echo=True显示翻译好的SQL语句。 | |
from sqlalchemy.orm import Session, sessionmaker |