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
| <?php | |
| # Kafka configuration (https://github.com/edenhill/librdkafka/blob/master/CONFIGURATION.md) | |
| $config = [ "metadata.broker.list" => "broker1.example.com", "socket.timeout.ms" => 30000, ... ]; | |
| # Create Kafka Producer object. | |
| # Brokers are specified through $config, but we could make it easier for people by having the first | |
| # argument be brokers as well, and rdkafka will use all brokers specified? | |
| $producer = new Kafka::Producer([$brokers,]? $config); |
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
| define("ace/mode/sql_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"], function(require, exports, module) { | |
| "use strict"; | |
| var oop = require("../lib/oop"); | |
| var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; | |
| var SqlHighlightRules = function() { | |
| var keywords = ( | |
| "add|aggregate|all|alter|and|api_version|as|asc|avro|between|bigint|binary|boolean|by|cached|case|cast|change|char|class|close_fn|column|columns|comment|compute|create|cross|data|database|databases|date|"+ |
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 (doc) { | |
| var origin_title = doc.title; | |
| setInterval(function() { | |
| doc.title = doc.title.length <= 15 | |
| ? origin_title | |
| : doc.title.slice(1, 1) + doc.title.slice(1, doc.title.length + 1); | |
| }, 300); | |
| })(document); |
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 sys | |
| import subprocess | |
| from urlparse import urlparse, parse_qs | |
| def main(script, plate): | |
| url = urlparse(plate) | |
| query_string = parse_qs(url.query) | |
| application = r'D:\Program Files\HeidiSQL\heidisql.exe' | |
| command = [application, |
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
| // ==UserScript== | |
| // @name block it | |
| // @namespace tranch | |
| // @description block item by domain on hacknews | |
| // @include http://news.dbanotes.net/* | |
| // @version 0.1 | |
| // @grant none | |
| // ==/UserScript== | |
| (function() { |
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
| // ==UserScript== | |
| // @name 虾米音乐下载 | |
| // @namespace tranch | |
| // @description 替换下载按钮的链接 | |
| // @include http://www.xiami.com/album/* | |
| // @include http://www.xiami.com/song/* | |
| // @version 0.06 | |
| // @grant none | |
| // ==/UserScript== | |
| (function (d, l) { |
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
| #!/bin/bash | |
| for i in $(find -name '*.ext'); do | |
| encoding=$(file -bi "$i" | sed -e 's/.*[ ]charset=//'); | |
| iconv -f $encoding -t UTF-8 -o "$i" "$i"; | |
| done |
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
| <!doctype html> | |
| <html lang="zh-CN"> | |
| <head> | |
| <meta charset="utf-8" /> | |
| <meta name="viewport" content="width=device-width, user-scalable=no"> | |
| <title>Feed Reader</title> | |
| <style> | |
| body { font-size: 14px; line-height: 1.3em; } | |
| #main { max-width: 768px; margin: auto; } | |
| #main-container { padding: 5px; background: #C3D9FF; } |
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(doc) { | |
| var API = 'https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=', | |
| img = doc.createElement('img'); | |
| img.style.cssText = 'position:fixed;top:5px;right:5px;z-index:2147483647'; | |
| img.src = API + encodeURI(location.href); | |
| img.onclick = function() { | |
| img.parentNode.removeChild(img) | |
| }; | |
| doc.body.appendChild(img) | |
| })(document) |
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
| <?php | |
| function random_text( $type = 'alnum', $length = 8 ) | |
| { | |
| switch ( $type ) { | |
| case 'alnum': | |
| $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; | |
| case 'alpha': | |
| $pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; | |
| break; |