Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash -e
# $File: setup-ipv6.sh
# $Date: Fri Mar 07 13:00:05 2014 +0800
# $Author: jiakai <jia.kai66@gmail.com>
PREFIX='2402:f000:1:1501:200:5efe'
ADDR_LOCAL=$(ip r g 8.8.8.8 | grep src | awk '{print $7}')
ADDR_OUT=$(curl ifconfig.me)
ADDR_REMOTE='166.111.21.1'
@jia-kai
jia-kai / c14auto
Last active August 29, 2015 14:05
c++14 auto type deduction
#include <iostream>
auto second_f(auto a, auto b) {
return b;
}
int main() {
auto second_l = [](auto a, auto b) {return b;};
std::cout << second_f(0u, -1) << std::endl;
std::cout << second_l(0u, -1) << std::endl;
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# $File: cart.py
# $Date: Sun Aug 28 23:00:26 2016 +0800
# $Author: jiakai <jia.kai66@gmail.com>
import gym
import numpy as np
import operator
@jia-kai
jia-kai / modify_vcxproj_itemdef.py
Created September 5, 2016 13:26
Modify vcxproj files programmatically
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import bs4
import argparse
import re
import os
class VcxprojModifier: