Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gogomarine
gogomarine / encryption.js
Created June 8, 2019 07:41 — forked from vlucas/encryption.js
Stronger Encryption and Decryption in Node.js
'use strict';
const crypto = require('crypto');
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bytes (32 characters)
const IV_LENGTH = 16; // For AES, this is always 16
function encrypt(text) {
let iv = crypto.randomBytes(IV_LENGTH);
let cipher = crypto.createCipheriv('aes-256-cbc', new Buffer(ENCRYPTION_KEY), iv);
@gogomarine
gogomarine / install-shadowsocks-local-service.sh
Created November 14, 2017 12:04 — forked from larryli/install-shadowsocks-local-service.sh
Debian/Ubuntu systemd shadowsocks-local service
#!/bin/sh
# sudo ./install-shadowsocks-local-service.sh
cp shadowsocks-local.default /etc/default/shadowsocks-local
cp shadowsocks-local.init /etc/init.d/shadowsocks-local
chmod +x /etc/init.d/shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc0.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc1.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc2.d/K01shadowsocks-local
ln -s ../init.d/shadowsocks-local /etc/rc3.d/K01shadowsocks-local
@gogomarine
gogomarine / Utils.java
Last active December 30, 2015 21:19
工具类,获取当前机器物理网卡信息,包括IP、Mac地址等
public class Utils {
//ipv4的判断规则
private static final Pattern IPV4 = Pattern.compile("((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\\.|$)){4}");
/**
* 这个过滤了 是回路的地址
*
* */