Skip to content

Instantly share code, notes, and snippets.

View YCF's full-sized avatar
🎯
Focusing

YouCanFly YCF

🎯
Focusing
View GitHub Profile
@YCF
YCF / python_mssql
Last active December 17, 2015 06:09
@app.route('/', methods=['GET', 'POST'])
def demo():
conn=pymssql.connect(host='blablabla\SQLEXPRESS',user='blabla',password='123',database='x',charset='utf8')
cur=conn.cursor()
sqlquery=u"SELECT TOP 1000 [ID],[姓名],[内容] FROM demo_db"
sqlquery=sqlquery.encode("utf8")
cur.execute(sqlquery)
row=cur.fetchone()
cts = [dict(name=row[1],ct=row[2]) for row in cur.fetchall()]
for i in cts:
# coding: utf-8
from flask import request, g
from functools import wraps
from flask import abort, session, redirect, url_for, flash
from .models import Topic, Attachment
from . import roles
def require_visitor(func):
"""仅允许非登陆用户访问,如signin页面"""
@YCF
YCF / module.js
Last active August 29, 2015 14:06 — forked from mikaelkaron/module.js
Async jquery multi ajax
define([ "when/parallel", "jquery" ], function (parallel, $) {
var tasks = [ "url1", "url2", "url3" ].map(function (url) {
return function () {
return $.get(url);
};
});
parallel(tasks)
.then(function (results) {
@YCF
YCF / v2ex_daily.go
Last active April 19, 2016 07:45 — forked from yinheli/v2ex_daily.go
领取 v2ex 每日奖励。命令行参数1=用户名,命令行参数2=密码。 %v2ex_dialy username pwd
package main
import (
"fmt"
"io/ioutil"
"net/http"
"net/url"
"os"
"regexp"
"strings"
@YCF
YCF / 17wo_daily.py
Last active April 20, 2016 06:48
联通 一起沃 17wo 自动签到领流量
#/usr/bin/env python
#coding:utf-8
import requests
import re
import time
import datetime
import sys
import json
reload(sys)
@YCF
YCF / v2ex_daily.py
Created April 24, 2016 23:29
20160420 匹配新登陆方式。
# coding:utf-8
import re
import requests
session = requests.Session()
# 领取 X 铜币
# 每日登录奖励已领取
@YCF
YCF / sqlite2json.go
Created March 2, 2017 11:49
查询数据库输出为json的例子
package main
import (
"database/sql"
"encoding/json"
"fmt"
"net/http"
"strings"
"github.com/go-ini/ini"
@YCF
YCF / sxhkd
Last active December 30, 2020 17:15
通过快捷键快速缩放窗口,实现窗口的伪造平铺
#伪平铺特性
#
# q w e LeftTop Max RightTop
# super + shift +: a s d ===> Left Center Right
# z x c LeftBottom unMax RightBottom
#
super + shift + {q,w,e,a,s,d,z,x,c}
sh -c "~/.config/sxhkd/window.sh {LT,M,RT,L,C,R,LB,U,RB}"
@YCF
YCF / main.go
Created October 20, 2017 02:34
qmk complier - golang
package main
import (
"Goose/conf"
"Goose/router"
"bytes"
"database/sql"
"fmt"
"html/template"
"io/ioutil"
@YCF
YCF / listen.py
Created January 20, 2018 13:35 — forked from l1905/listen.py
头脑王者答题辅助(https://github.com/chxj1992/hortor_cheater, 将作者的listen.py替换即可)
import re
import json
from mitmproxy import ctx
from urllib.parse import quote
import string
import requests
def response(flow):
path = flow.request.path
if path == '/question/bat/findQuiz':