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
/path/to/configsvr/config.log{ | |
weekly | |
rotate 9 | |
compress | |
size 100M | |
sharedscripts | |
create | |
postrotate | |
/bin/kill -SIGUSR1 `cat /path/to/configsvr/mongd.lock 2> /dev/null` 2> /dev/null || true | |
/bin/find /path/to/configsvr/ -type f -size 0 -regextype sed -regex ".*\.log\.[0-9]\{4\}-[0-9]\{2\}-[0-9]\{2\}T[0-9]\{2\}-[0-9]\{2\}-[0-9]\{2\}" -delete 2> /dev/null |
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
public class HeightedQuickUnionUF { | |
private int[] id; // id[i] = parent of i | |
private int[] height; // sz[i] = number of objects in subtree rooted at i | |
private int count; // number of components | |
// Create an empty union find data structure with N isolated sets. | |
public HeightedQuickUnionUF(int N) { | |
count = N; | |
id = new int[N]; | |
height = new int[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
box = $("div.m-chatform .edit textarea") | |
btn = $("div.m-chatform .btn") | |
var txt = '' | |
lines = [] | |
function init() { | |
var xhr = new XMLHttpRequest() | |
xhr.open("GET", "http://10.240.138.100/tmp/tang.txt", true) | |
xhr.onreadystatechange = function() { | |
if (xhr.readyState == 4 && xhr.status == 200) { |
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
2.0.0.0/7 | |
4.0.0.0/6 | |
8.0.0.0/7 | |
11.0.0.0/8 | |
12.0.0.0/7 | |
15.0.0.0/8 | |
16.0.0.0/5 | |
24.0.0.0/7 | |
26.0.0.0/8 | |
28.0.0.0/6 |
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 | |
import sys | |
import socket | |
data = """ | |
100.200.208.12-100.200.208.46 : /xxx/rack_1 | |
""" | |
def ip_integer_from_string(s): | |
return reduce(lambda a,b: a<<8 | b, map(int, s.split("."))) |
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/python2 | |
#coding=utf-8 | |
import os | |
import urllib2 | |
import zipfile | |
import zlib | |
from urlparse import urlparse | |
from time import strftime,localtime | |
def initsites(filename): |
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 sys,struct,socket,array,datetime | |
def ip2str(ip): | |
return str(ip>>24)+'.'+str((ip>>16)&0xffL)+'.' \ | |
+str((ip>>8)&0xffL)+'.'+str(ip&0xffL) | |
def str2ip(s): | |
(ip,) = struct.unpack('!I',socket.inet_aton(s)) | |
return ((ip>>24)&0xffL)|((ip&0xffL)<<24) \ |
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
public int whileLoop(int); | |
descriptor: (I)I | |
flags: ACC_PUBLIC | |
Code: | |
stack=2, locals=3, args_size=2 | |
0: iconst_0 | |
1: istore_2 | |
2: iload_2 | |
3: iload_1 | |
4: if_icmpge 16 |
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 scala.collection.immutable.NumericRange | |
import scala.collection.mutable.ArrayBuffer | |
import scala.reflect.ClassTag | |
private object ParallelCollectionRDD { | |
/** | |
* Slice a collection into numSlices sub-collections. One extra thing we do here is to treat Range | |
* collections specially, encoding the slices as other Ranges to minimize memory cost. This makes | |
* it efficient to run Spark over RDDs representing large sets of numbers. And if the collection | |
* is an inclusive Range, we use inclusive range for the last slice. |
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
case class BitMap(val n: Int) { | |
private val bytes = Array.fill(n / 8 + 1)(0.toByte) | |
def setBit(i: Int) { | |
bytes(i / 8) = (bytes(i / 8) | (1 << (i & 7))).toByte | |
} | |
def unSetBit(i: Int) { | |
bytes(i / 8) = (bytes(i / 8) & ~(1 << (i & 7))).toByte | |
} |
OlderNewer