This file contains 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
# coding: utf-8 | |
from __future__ import print_function | |
import feedparser | |
import sys, codecs | |
if not sys.stdout.isatty(): | |
sys.stdout = codecs.getwriter('utf8')(sys.stdout) | |
if __name__ == '__main__': |
This file contains 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
''' | |
Cache the generic relation field of all the objects | |
in the queryset, using larger bulk queries ahead of time. | |
Improved from original by Daniel Roseman: | |
http://blog.roseman.org.uk/2010/02/22/django-patterns-part-4-forwards-generic-relations/ | |
and | |
justinfx's gist cache_generics.py : |
This file contains 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
diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py | |
index 18fffdc..a0bfce8 100644 | |
--- a/debug_toolbar/panels/sql.py | |
+++ b/debug_toolbar/panels/sql.py | |
@@ -193,8 +193,14 @@ class SQLDebugPanel(DebugPanel): | |
stacktrace = [] | |
for frame in query['stacktrace']: | |
params = map(escape, frame[0].rsplit('/', 1) + list(frame[1:])) | |
+ params_dict = dict((unicode(idx), v) for idx, v in enumerate(params)) | |
try: |
This file contains 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
// ==UserScript== | |
// @name Retry Google Sorry | |
// @description 当 Google 搜索遇到 We're sorry... 时, 自动刷新页面重试, 使用代理访问 Google 时, 常遇到这种现象 | |
// @namespace https://gist.github.com/glasslion | |
// @author glasslion | |
// @include http*://ipv4.google.com/sorry/index?* | |
// @version 1.2 | |
// @run-at document-end | |
// @grant none | |
// ==/UserScript== |
This file contains 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
// ==UserScript== | |
// @name Piratebay Helper | |
// @description | |
// @namespace https://userscripts.org/users/glasslion | |
// @include *pirate* | |
// @license MIT | |
// @version 0.1 | |
// @require https://code.jquery.com/jquery-2.1.3.min.js | |
// @grant GM_addStyle | |
// @grant GM_setClipboard |
This file contains 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 sleep(ms) { | |
return new Promise(resolve => setTimeout(resolve, ms)); | |
} | |
async function deleteMails() { | |
jQuery('._n_U').click() | |
await sleep(500); | |
jQuery('.ms-fcl-np[title="删除(Del)"]').click() | |
} |
This file contains 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 -*- | |
""" | |
Bilibili Screenshots Syncer | |
It can download `/Pictures/bili/screenshot` from a Android phone via ftp. | |
It also rename the picture so the timestamp comes first. | |
""" | |
from __future__ import print_function | |
import argparse |
This file contains 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
// 1. jQuerify | |
// 2. Run in console | |
links = "" | |
$('a.ytd-grid-video-renderer').each(function(){ | |
links += 'https://www.youtube.com' + $(this).attr('href') + '\n' | |
}) |
This file contains 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
# lastpass2keepass | |
# Supports: | |
# Keepass XML - keepassxml | |
# USAGE: python lastpass2keepass.py exportedTextFile | |
# The LastPass Export format; | |
# url,username,password,1extra,name,grouping(\ delimited),last_touch,launch_count,fav | |
import sys, csv, time, datetime, itertools, re, operator # Toolkit | |
import xml.etree.ElementTree as ET # Saves data, easier to type |
This file contains 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
# -*- coding: utf-8 -*- | |
import glob | |
import os | |
import urllib | |
def confirm(text): | |
answer = raw_input(text) | |
answer = answer.lower() | |
return answer == 'y' or answer == 'yes' |
OlderNewer