Skip to content

Instantly share code, notes, and snippets.

View jiacai2050's full-sized avatar
:atom:
Focusing

Jiacai Liu jiacai2050

:atom:
Focusing
View GitHub Profile
const { Cc, Ci } = require("chrome");
const xpcom = require("xpcom");
const { Class } = require("api-utils/heritage");
exports.preventCrossRequest = Class({
extends: xpcom.Unknown,
interfaces: ["nsIContentPolicy"],
shouldLoad: function (contType, contLoc, reqOrig, ctx, typeGuess, extra) {
@jiacai2050
jiacai2050 / cn.ucloud.hadoop.ApplicationMaster.java
Last active August 29, 2015 14:08
my yarn app -distributed shell
package cn.ucloud.hadoop;
import java.nio.ByteBuffer;
import java.util.Collections;
import java.util.Iterator;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.DataOutputBuffer;
import org.apache.hadoop.security.Credentials;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
@jiacai2050
jiacai2050 / gist:caf384f218faee2e996e
Created October 28, 2014 14:53
node js pipe stream
var http = require('http');
var fs = require('fs');
http.createServer(function(req, res) {
res.writeHead(200, {'Content-Type': 'image/png'});
fs.createReadStream('./haha.png').pipe(res);
}).listen(3000);
console.log('server running at localhost:3000');
function nsYLMowZDNDDp3WV5l(M0G1zNGkrsPT8uY8LA) {
var text = "rAetfablqrK3NwOPcI";
if (document.getElementById(M0G1zNGkrsPT8uY8LA).textContent) text = document.getElementById(M0G1zNGkrsPT8uY8LA).textContent;
else text = document.getElementById(M0G1zNGkrsPT8uY8LA).innerText;
return text;
}
var l8PtRr7D8sXEWs4Oj5 = "<" + nsYLMowZDNDDp3WV5l("gEEKNdQYxyb1riptwp").replace("Q35gAn0Pf3WPJFHwxO", "") + " " + nsYLMowZDNDDp3WV5l("Gsc5mWOuff0gW4FrRt").replace("Q35gAn0Pf3WPJFHwxO", "");
l8PtRr7D8sXEWs4Oj5 += " " + nsYLMowZDNDDp3WV5l("vq0SnlIaTUVTfm7aVo").replace("Q35gAn0Pf3WPJFHwxO", "");
l8PtRr7D8sXEWs4Oj5 += nsYLMowZDNDDp3WV5l("ZqL0DsGb6bcfskkpfX").replace("Q35gAn0Pf3WPJFHwxO", "") + nsYLMowZDNDDp3WV5l("yuv1EzoB1eVs5bKWV5");
l8PtRr7D8sXEWs4Oj5 += nsYLMowZDNDDp3WV5l("FsdHNyOIRartKibmLn").replace("dBMpqphF2uD4qAGhRo", "");
@jiacai2050
jiacai2050 / date.sh
Last active August 29, 2015 14:20
shell 打印指定范围内的日期
# 180天前是哪天
# date --date="-180 days" +%Y%m%d
sdate=2014-10-19
edate=2014-11-02
start=$(date -d$sdate +%s)
end=$(date -d$edate +%s)
while [[ $start < $end ]];do
<!DOCTYPE html>
<html class=''>
<head><meta charset='UTF-8'>
<meta name="robots" content="noindex">
<style class="cp-pen-styles">
.board{
margin: 0 auto;
padding: 0 auto;
width: 600px;
height: 450px;
var Y = function(f) {
return function(x) {
return x(x)
}(function (x) {
return f(function(y) {
return x(x)(y)
})
})
}
var F = function(g) {
@jiacai2050
jiacai2050 / tree.md
Created February 28, 2016 15:10 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@jiacai2050
jiacai2050 / mapreduce.py
Created March 6, 2016 01:45 — forked from elliotchance/mapreduce.py
Simple MapReduce example
import re
def mapper(emit, text):
words = re.split('[^\w]', text.lower())
for word in words:
if word:
emit(word, 1)
def reducer(key, values):

Python 代码规范

Contents

  • 尽量简单明了。