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 getTaobaoURLFromShortURL($shortURL) | |
{ | |
$contents = file_get_contents($shortURL); | |
$pattern = '/d="J_Url" value=\'(.+)\'>./'; | |
preg_match($pattern, $contents, $matches); | |
return urldecode($matches[1]); | |
} | |
function getItemIdFromURL($itemURL) |
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
SELECT | |
d.parent_id, views, cdn, | |
from_unixtime(1405267200 + row_number * 60) as step_time | |
FROM | |
(SELECT | |
apptype_id, game_id, count(view_id) AS views, r.row_number, | |
sum(bytes_loaded_cdn1 + bytes_loaded_cdn2 + bytes_loaded_cdn3 + bytes_loaded_cdn4) /duration as cdn | |
FROM | |
(SELECT | |
@curRow:=@curRow + 1 AS row_number |
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 scala.io._ | |
import java.io._ | |
import java.util.regex._ | |
object ErrorLogAnalyze { | |
def main(args: Array[String]) = { | |
val files = if (args.length == 0) new File(".") else new File(args(0)) | |
val lines = getLogs(files.listFiles.filter(_.getName.contains("error")).toList) | |
val errorAndHeartbeat = lines.partition(line => line.contains("ERROR") && line.contains("HEARTBEAT"))._1 |
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 scala.collection.mutable.LinkedList | |
import scala.collection.mutable.ListBuffer | |
import scala.compat._ | |
import java.io._ | |
import java.net._ | |
import java.util._ | |
import scala.util.Random | |
import java.nio.charset.Charset | |
import java.util.concurrent._ | |
import java.util.concurrent.atomic._ |
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
[root@localhost ~]# hdparm -Tt /dev/sdb1 | |
/dev/sdb1: | |
Timing cached reads: 25642 MB in 2.00 seconds = 12842.90 MB/sec | |
Timing buffered disk reads: 532 MB in 3.01 seconds = 176.98 MB/sec | |
[root@localhost ~]# mount | |
/dev/mapper/VolGroup-lv_root on / type ext4 (rw) | |
proc on /proc type proc (rw) | |
sysfs on /sys type sysfs (rw) | |
devpts on /dev/pts type devpts (rw,gid=5,mode=620) |
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
package com.jaunty.hive.udf; | |
import java.util.Map; | |
import org.apache.hadoop.hive.ql.exec.Description; | |
import org.apache.hadoop.hive.ql.exec.UDFArgumentLengthException; | |
import org.apache.hadoop.hive.ql.metadata.HiveException; | |
import org.apache.hadoop.hive.ql.parse.SemanticException; | |
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator; | |
import org.apache.hadoop.hive.ql.udf.generic.GenericUDAFEvaluator.AggregationBuffer; |
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
106626 Lock wait timeout exceeded; try restarting transaction | |
106627 java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction | |
106628 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074) | |
106629 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074) | |
106630 at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006) | |
106631 at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468) | |
106632 at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629) | |
106633 at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719) | |
106634 at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155) | |
106635 at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1379) |
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
jj@hellojinjie hue-2.5.0 :) $ python2.7 /home/jj/Workspaces/lib/hue-2.5.0/tools/virtual-bootstrap/virtual-bootstrap.py -qq --no-site-packages /home/jj/Workspaces/lib/hue-2.5.0/build/env | |
Traceback (most recent call last): | |
File "/home/jj/Workspaces/lib/hue-2.5.0/tools/virtual-bootstrap/virtual-bootstrap.py", line 1504, in <module> | |
main() | |
File "/home/jj/Workspaces/lib/hue-2.5.0/tools/virtual-bootstrap/virtual-bootstrap.py", line 547, in main | |
use_distribute=options.use_distribute) | |
File "/home/jj/Workspaces/lib/hue-2.5.0/tools/virtual-bootstrap/virtual-bootstrap.py", line 637, in create_environment | |
install_setuptools(py_executable, unzip=unzip_setuptools) | |
File "/home/jj/Workspaces/lib/hue-2.5.0/tools/virtual-bootstrap/virtual-bootstrap.py", line 379, in install_setuptools | |
_install_req(py_executable, unzip) |
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
final boolean result[] = {false}; | |
java.security.AccessController.doPrivileged(new java.security.PrivilegedAction() { | |
public Object run() { | |
try { | |
InetAddress a1 = InetAddress.getByName(h1); | |
InetAddress a2 = InetAddress.getByName(h2); | |
result[0] = a1.equals(a2); | |
} catch (UnknownHostException e) { | |
} catch (SecurityException e) { | |
} |
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
this="${BASH_SOURCE-$0}" | |
dir=$(cd -P -- "$(dirname -- "$this")" && pwd -P) |