JNI (Java Native Interface) allows implementing methods in C/C++, and use them in Java.
I use hombrew install java, java version is java 10.
$ java --version
java 10.0.2 2018-07-17
from base64 import urlsafe_b64encode, urlsafe_b64decode | |
from Crypto.Cipher import AES | |
from Crypto import Random | |
BS = 16 | |
pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) | |
unpad = lambda s: s[:-ord(s[len(s) - 1:])] | |
base64pad = lambda s: s + '=' * (4 - len(s) % 4) |
package main | |
import ( | |
"crypto/aes" | |
"crypto/cipher" | |
"crypto/rand" | |
"encoding/base64" | |
"errors" | |
"io" | |
"log" |
package main | |
import ( | |
"fmt" | |
"os" | |
"os/signal" | |
"syscall" | |
) | |
func main() { |
// getMacAddr gets the MAC hardware | |
// address of the host machine | |
func getMacAddr() (addr string) { | |
interfaces, err := net.Interfaces() | |
if err == nil { | |
for _, i := range interfaces { | |
if i.Flags&net.FlagUp != 0 && bytes.Compare(i.HardwareAddr, nil) != 0 { | |
// Don't use random as we have a real address | |
addr = i.HardwareAddr.String() | |
break |
DB
ovs-vsctl list interface
ovs-vsctl --columns=ofport,name list Interface
ovs-vsctl --columns=ofport,name --format=table list Interface
ovs-vsctl --format=table --columns=name,mac_in_use find Interface name=br-dpdk1
ovs-vsctl get interface vhub656c3cb-23 name
ovs-vsctl set port vlan1729 tag=1729
ovs-vsctl get port vlan1729 tag
emacs --daemon
to run in the background.
emacsclient.emacs24 <filename/dirname>
to open in terminal
NOTE: "M-m and SPC can be used interchangeably".
C-/
C-?
M-c
2. Upper Case : M-u
M-l
package main | |
import ( | |
"dxmall/models/user" | |
"dxmall/utils" | |
"fmt" | |
"net/http" | |
"strings" |
package user | |
import ( | |
"fmt" | |
"regexp" | |
"strconv" | |
"time" | |
"dxmall/utils" |
import time | |
from datetime import datetime, date | |
# 今天 | |
datetime.datetime.today().date().isoformat() | |
# 通过日期对象生成时间戳 | |
int(time.mktime(datetime.now().timetuple())) | |
# 通过时间戳生成日期对象,timestamp 的时间戳以秒为单位 |