Skip to content

Instantly share code, notes, and snippets.

View rench's full-sized avatar
🎯
Focusing

rench rench

🎯
Focusing
View GitHub Profile
@rench
rench / ConsistentHash.java
Created April 6, 2017 03:14 — forked from meigesir/ConsistentHash.java
一致性hash算法的实现。
import java.util.ArrayList;
import java.util.Collection;
import java.util.SortedMap;
import java.util.TreeMap;
import org.apache.commons.lang.RandomStringUtils;
import com.google.common.base.Charsets;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hashing;
@rench
rench / nodejs.sh
Created May 20, 2017 07:25 — forked from Gioyik/nodejs.sh
Script to cross compile NodeJS for ARMv7
#!/bin/sh -e
#Define our target device
export TARGET_ARCH="-march=armv7-a"
export TARGET_TUNE="-mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mthumb-interwork -mno-thumb"
#Define the cross compilators on your system
export AR="arm-linux-gnueabi-ar"
export CC="arm-linux-gnueabi-gcc"
export CXX="arm-linux-gnueabi-g++"
//js fn
function diag_k3_screen(element){
var name = element.name;
var value = element.value; //
if(value === 'all'){
var legend = document.getElementById('diag-rc-legend');
var output = document.getElementById('diag-rc-output');
if (legend && output)
{
output.innerHTML =
@rench
rench / broadlinkjs-sm_index.js
Created June 15, 2017 14:22
broadlinkjs-sm_index.js
var util = require('util');
let EventEmitter = require('events');
let dgram = require('dgram');
let os = require('os');
let crypto = require('crypto');
var Broadlink = module.exports = function() {
EventEmitter.call(this);
this.devices = {};
}
@rench
rench / elgato-eve.md
Created June 21, 2017 09:30 — forked from gomfunkel/elgato-eve.md
Elgato Eve HomeKit Services & Characteristics

Elgato Eve HomeKit Services & Characteristics

A work in progress collection of proprietary and as of yet undocumented HomeKit characteristics and their UUIDs used by Elgato Eve.

This list is not including all Eve accessories available and some services and characteristics still make no sense to me. If you have anything to contribute, please leave a comment. There is no guarantee that the information listed below is correct.

Elgato Eve Energy (Firmware Revision 1.3.1;466)

Service - Characteristic UUID R W Type Description
@rench
rench / node --v8-options
Created July 4, 2017 15:39
node --v8-options
root@LEDE:~# ./node --v8-options
target arm v7 vfp3-d16 softfp
ARMv8=0 ARMv7=1 VFP3=1 VFP32DREGS=0 NEON=0 SUDIV=0 MLS=1UNALIGNED_ACCESSES=1 MOVW_MOVT_IMMEDIATE_LOADS=0 COHERENT_CACHE=0 USE_EABI_HARDFLOAT=0
Usage:
@rench
rench / ExtractOriginalMethodNameFromReferenceExample.java
Created April 25, 2019 07:33 — forked from thomasdarimont/ExtractOriginalMethodNameFromReferenceExample.java
One can use a SerializedLambda to unreflect the actual method referred to by a MethodReference
package de.tdlabs.training.hacks;
import java.io.Serializable;
import java.lang.invoke.SerializedLambda;
import java.lang.reflect.Method;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Supplier;
import static java.util.Arrays.asList;
@rench
rench / TaskTest.java
Created May 22, 2019 08:26
FutureTaskDemo
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.Semaphore;
import java.util.stream.IntStream;
public class TaskTest {
@rench
rench / gist:8acae014fcdd47e9cdfde39e77b02f02
Last active April 18, 2024 16:18
发票代码: 051002100511
发票代码:
051002100511
四川增值税电子普通发票
发票号码:
33531635
开票日期:
2022年07月21日
机器编号:
661620006217
校验码:
@rench
rench / XORCipher.js
Created May 7, 2024 11:16 — forked from sukima/XORCipher.js
A Super simple encryption cipher using XOR and Base64 in JavaScript
// XORCipher - Super simple encryption using XOR and Base64
//
// Depends on [Underscore](http://underscorejs.org/).
//
// As a warning, this is **not** a secure encryption algorythm. It uses a very
// simplistic keystore and will be easy to crack.
//
// The Base64 algorythm is a modification of the one used in phpjs.org
// * http://phpjs.org/functions/base64_encode/
// * http://phpjs.org/functions/base64_decode/