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 python3 | |
import requests | |
import re | |
from lxml import etree | |
import genanki | |
import tempfile | |
import sys | |
import os | |
import io |
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
package main | |
import ( | |
"bytes" | |
"flag" | |
"fmt" | |
"io" | |
"log" | |
"net/http" | |
"net/url" |
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
#!/bin/sh | |
ver=$1 | |
plat=$(uname -s) | |
plat=${plat,,} | |
arch=$(uname -m) | |
arch=${arch,,} | |
case $arch in | |
"i686") | |
arch="386" | |
;; |
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
import subprocess | |
ping = subprocess.Popen(['ping', 'www.taobao.com'], | |
stdout=subprocess.PIPE, | |
stderr=subprocess.PIPE) | |
for line in iter(ping.stdout.readline, ''): | |
print line |
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
var Wget = require('./http_request.js').HttpRequest; | |
var total = 0; | |
var fail = 0; | |
setInterval(function() { | |
console.log(total + 'qps'); | |
console.log(fail + 'failed'); | |
total = 0; | |
fail = 0; |
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 memcache_lock_clean() { | |
global $memcache_locks; | |
$mem = require_memcache(); | |
foreach($memcache_locks as $key=>$v){ | |
$mem->delete('LOCK' . $key); | |
} | |
} | |
register_shutdown_function('memcache_lock_clean'); |
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 debug_log() { | |
if (false) return; //开关 | |
static $fp = 0; | |
if ($fp === 0) { | |
$logname = 'myprojectname';//日志名称 | |
$fp = fopen('/tmp/' . $logname . '.debug.log', 'a'); | |
} | |
$traces = debug_backtrace(); | |
$trace = count($traces) > 1 ? $traces[1] : $traces[0]; | |
$log_msg = date('Y-m-d H:i:s') . ' FILE:' . basename($trace['file']) . ' FUNC:' . $trace['function'] . ' LINE:' . $trace['line'] . ' :' . "\n"; |