Skip to content

Instantly share code, notes, and snippets.

View taojy123's full-sized avatar

taojy123 taojy123

View GitHub Profile
@taojy123
taojy123 / GuessNums.html
Last active December 8, 2020 02:38
2018年在前往欧洲的飞机上编写
<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;
}
@taojy123
taojy123 / lunar.py
Created January 11, 2019 10:25
python 农历
# lunar.py
# 2015/02/27 罗兵
import datetime
class Lunar(object):
#******************************************************************************
# 下面为阴历计算所需的数据,为节省存储空间,所以采用下面比较变态的存储方法.
#******************************************************************************
#数组g_lunar_month_day存入阴历1901年到2050年每年中的月天数信息,
#阴历每月只能是29或30天,一年用12(或13)个二进制位表示,对应位为1表30天,否则为29天
@taojy123
taojy123 / pynput.demo.py
Created April 16, 2019 08:32
pynput demo sctipt
# 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
@taojy123
taojy123 / rc4.js
Last active May 20, 2024 05:20
rc4 对称加密,使用 python 和 js 实现
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
@taojy123
taojy123 / groxy.go
Last active December 10, 2020 03:02
tcp 端口转发并拦截流量推到 kafka 中
package main
import (
"fmt"
"os"
"net"
"github.com/Shopify/sarama"
)
var port = "10086"
@taojy123
taojy123 / cassandra_paging.py
Created February 24, 2020 05:25
Python Cassandra Paging
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)
@taojy123
taojy123 / sdd_weekly.sqlx
Last active April 7, 2020 01:14
sdd_weekly.sqlx
-- ! =============== 通用方法 ==================
func daily(table_name):
-- 每日统计加上周统计日字段
(
SELECT
*,
CASE WHEN date_format(date(`日期`),'%w') < 5
THEN subdate(date(`日期`), date_format(date(`日期`),'%w') -4 )
@taojy123
taojy123 / button.html
Last active June 17, 2020 10:12
css 画 button
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.botton-container{
position: absolute;
left: 50%;
top: 45%;
transform: translate(-50%);
}
@taojy123
taojy123 / sm4.py
Last active May 6, 2020 02:29
Python SM4
#!/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',
@taojy123
taojy123 / orm.py
Created May 21, 2020 02:53
pymysql + sqlalchemy
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