Skip to content

Instantly share code, notes, and snippets.

@xx7y7xx
xx7y7xx / uuid2path.py
Last active December 2, 2015 07:09
Convert JCR UUID to filesystem path
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import textwrap
def uuid2path(uuid):
uuid2 = uuid.replace("-", "")
list = textwrap.wrap(uuid2, 4)
path = "/".join(list)
@xx7y7xx
xx7y7xx / render.sh
Last active February 23, 2016 06:51
Create scene and render with Blender
#!/bin/bash
# Create scene and render with Blender.
# This script depends some other scripts to work.
# Run this script in jenkins: http://192.168.2.21:8080/view/render/job/render
# You can download this script from https://gist.github.com/xxd3vin/feffe28c4da50b666422
# Copyright (C) 2015 Devin Chen - All Rights Reserved
# Permission to copy and modify is granted under the MIT license
# Last modified 2/23/2016
@xx7y7xx
xx7y7xx / remove_preview_node.sh
Last active February 24, 2016 09:51
删除无效的效果图节点
#!/bin/bash
# Usage:
# Save xiaoguotu table to /tmp/joblist.txt
# remove_preview_node.sh pansuo
# Download this script: https://gist.github.com/xxd3vin/ce339cb02d2645bc9102
joblist=/tmp/joblist.txt
tmpfile=${joblist}.tmp
@xx7y7xx
xx7y7xx / extend.js
Created March 29, 2016 02:43
Method to setup inheritance
// http://stackoverflow.com/a/4389429
function extend(base, sub) {
// Avoid instantiating the base class just to setup inheritance
// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/create
// for a polyfill
// Also, do a recursive merge of two prototypes, so we don't overwrite
// the existing prototype, but still maintain the inheritance chain
// Thanks to @ccnokes
var origProto = sub.prototype;
sub.prototype = Object.create(base.prototype);
@xx7y7xx
xx7y7xx / math.html
Created April 14, 2016 06:57
math tool
<script src="http://libs.baidu.com/jquery/1.10.2/jquery.js"></script>
<script src="http://libs.baidu.com/jqueryui/1.10.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://libs.baidu.com/jqueryui/1.10.2/themes/smoothness/jquery-ui.css">
<!--<link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>-->
a:<input id="a" value="56.5" /><div id="s-a" class="slider"></div><br>
b:<input id="b" value="56.5" /><div id="s-b" class="slider"></div><br>
// input file `/tmp/xx3` is created by:
//
// ```
// $ ls -d -1 $PWD/**/*
// ```
var util = require('util');
var lineReader = require('readline').createInterface({
input: require('fs').createReadStream('/tmp/xx3')
// http://mongodb.github.io/node-mongodb-native/2.0/getting-started/quick-tour/
var MongoClient = require('mongodb').MongoClient
, assert = require('assert');
// Connection URL
var url = 'mongodb://localhost:27017/myproject';
var insertDocuments = function(db, callback) {
// Get the documents collection
@xx7y7xx
xx7y7xx / portal.js
Last active August 9, 2016 07:59
~/opt/uap/NC633bgy0409_160708/hotwebs/portal/tpl/webclassic/allcompressed/portal.js
var link_Pre = "P_U_R_L_";
var tipShowFlag = false;
var currentTipMeta = "";
$(function() {
window.NCPortalSupportPortletMode = ["view", "edit", "help"];
window.NCPortalSupportPortletModeName = {
view: trans("ml_portlet_mode_view"),
edit: trans("ml_portlet_mode_edit"),
help: trans("ml_portlet_mode_help")
};
@xx7y7xx
xx7y7xx / README.md
Last active August 9, 2016 13:58
社会保险网上服务手机客户端下载
@xx7y7xx
xx7y7xx / UUID2Hex.java
Last active September 19, 2016 13:22
Convert UUID (hex string) to 128 bits
/**
* Copyright 2016 by d3vin
* https://gist.github.com/xxd3vin/ed525567e20dd5e6fc5f44e40143caaf
*
* Convert UUID (hex string) to 128 bits
* - msb: most significant 64 bits
* - lsb: least significant 64 bits
*
* Source code borrow from: https://svn.apache.org/repos/asf/jackrabbit/trunk/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/id/NodeId.java
*