Skip to content

Instantly share code, notes, and snippets.

View LuoZijun's full-sized avatar
🎯
Focusing

寧靜 LuoZijun

🎯
Focusing
View GitHub Profile
@LuoZijun
LuoZijun / vpnsetup.sh
Last active August 29, 2015 14:06 — forked from hwdsl2/.MOVED.md
#!/bin/sh
#
# Amazon EC2 user-data file for automatic configuration of IPsec/L2TP VPN
# on a Ubuntu server instance. Tested with 14.04 (Trusty) AND 12.04 (Precise).
# With minor modifications, this script *can also be used* on dedicated servers
# or any KVM- or XEN-based Virtual Private Server (VPS) from other providers.
#
# For detailed instructions, please see:
# https://blog.ls20.com/ipsec-l2tp-vpn-auto-setup-for-ubuntu-12-04-on-amazon-ec2/
# Original post by Thomas Sarlandie:
@LuoZijun
LuoZijun / IP2Hex.py
Last active August 18, 2022 10:51
IPv4 Address to a 32-bit integer value
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
IPv4 addresses to a 32-bit integer value
Document: https://en.wikipedia.org/wiki/IPv4#Address_representations
IPv4 addresses may be in any notation expressing a 32-bit integer value,
#!/usr/bin/env nodejs
// -*- mode: js -*-
/*
NodeJS:
WEB: https://nodejs.org/
Package: https://www.npmjs.com/
*/
#!/usr/bin/env fibjs
// -*- mode: js -*-
/*
Fibjs:
web: http://fibjs.org/
Package: http://fpmjs.org/
Install:
1. $ npm install fibjs
@LuoZijun
LuoZijun / test.html
Last active August 29, 2015 14:26
读取 二进制文件
<html>
<head>
<script type="text/javascript">
// 使用方法:
// 页面加载完毕后,打开 浏览器控制台,调用函数 `get_file_content()` 即可以看到数据。
function chr (code){
return String.fromCharCode(parseInt(code));
}
function ord(s){
return s.charCodeAt(0);
@LuoZijun
LuoZijun / aes.py
Last active January 12, 2021 05:14
Python AES
#!/usr/bin/env python
#coding: utf8
import base64
import hashlib
import binascii
from Crypto import Random
from Crypto.Cipher import AES
from os import urandom
@LuoZijun
LuoZijun / gs_query.py
Created October 29, 2015 04:26
工商营业执照报备信息 抓取脚本
#!/usr/bin/env python
#coding: utf8
import json, re
import requests
try:
from bs4 import BeautifulSoup
except:
@LuoZijun
LuoZijun / README.rst
Last active February 17, 2016 16:08
JSX Parse

JSX 字符串提取

代码依赖 Node.js 运行环境以及 Python 运行环境。

下面将安装 Node.js 和 Python 运行时:

@LuoZijun
LuoZijun / README.rst
Last active March 12, 2016 00:08
Go-Sqlite3
Version

0.2

image

使用

程序改为了 命令行调用模式。

@LuoZijun
LuoZijun / rgb2ycbcr.py
Last active August 1, 2021 07:12
RGB to YCbCr
def rgb_to_ycbcr(r, g, b):
assert(255>=r)
assert(255>=g)
assert(255>=b)
y = 0.299*r + 0.587*g + 0.114*b
cb = 128 - 0.168736*r - 0.331364*g + 0.5*b
cr = 128 + 0.5*r - 0.418688*g - 0.081312*b
return int(y), int(cb), int(cr)