Skip to content

Instantly share code, notes, and snippets.

@vmlinz
vmlinz / rust_cstring.rs
Created May 8, 2015 01:08
Rust and C string interoperation
#![feature(libc)]
extern crate libc;
use std::ffi::{CStr, CString};
use std::str;
use libc::*;
extern "C" fn my_string() -> *const c_char {
let c_to_print = CString::new("Hello").unwrap();
c_to_print.as_ptr()
@vmlinz
vmlinz / xz_js.md
Created May 16, 2015 17:35
create lzma2 / xz js from emscripten

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@vmlinz
vmlinz / IPSecDemo.m
Last active August 29, 2015 14:22 — forked from zqqf16/IPSecDemo.m
- (void)viewDidLoad
{
[super viewDidLoad];
// init VPN manager
self.vpnManager = [NEVPNManager sharedManager];
// load config from perference
[_vpnManager loadFromPreferencesWithCompletionHandler:^(NSError *error) {
@vmlinz
vmlinz / iptables_acct.py
Created June 19, 2015 11:19
Create iptables accounting rule using python
# -*- coding: utf-8 -*-
import iptc
def add_port_out_monitor(ip="10.0.2.15", port="9999"):
table = iptc.Table(iptc.Table.FILTER)
chain = iptc.Chain(table, "OUTPUT")
rule = iptc.Rule()
rule.src = ip
2015-06-26 02:42:19 +0800
./configure
--prefix=/usr/local
--mandir=/usr/local/Cellar/vim/7.4.712_1/share/man
--enable-multibyte
--with-tlib=ncurses
--enable-cscope
--with-features=huge
--with-compiledby=Homebrew
@vmlinz
vmlinz / android_app_design.md
Last active January 16, 2016 05:48
Android app design resources
@vmlinz
vmlinz / vagrant_osx_10.11.md
Last active August 29, 2015 14:23
Vagrant bin doesn't appear in /usr/bin in OSX 10.11