Skip to content

Instantly share code, notes, and snippets.

View zarzen's full-sized avatar

Zhen Zhang zarzen

View GitHub Profile
@zarzen
zarzen / spacemacs-org-pomodoro.org
Last active July 20, 2018 20:39
spacemacs org-pomodoro setup for Windows

Install mplayer

Download from sourceforge

Set Audio Player in .spacemacs

(setq org-pomodoro-audio-player "C:/Applications/mplayer/mplayer.exe ")

Write this code under dotspacemacs/user-config

Why not use VLC

vlc.exe only work with backslash in windows system, but org-pomodoro use slash as path separator.

  • Get an error while testing
Traceback (most recent call last):
  File "example/image-classification/train_mnist.py", line 1, in <module>
    import find_mxnet
  File "/Users/zarzen/Development/mxnet/example/image-classification/find_mxnet.py", line 2, in <module>
    import mxnet as mx
  File "/usr/local/lib/python2.7/site-packages/mxnet-0.7.0-py2.7.egg/mxnet/__init__.py", line 7, in <module>
    from .base import MXNetError
@zarzen
zarzen / Q1-e-p2
Last active September 12, 2016 13:03
Outer join equivalent
SELECT
p1.cid, p2.cid, p1.n + p2.n
FROM
(SELECT
cid, COUNT(Temp.pid) AS n
FROM
(SELECT DISTINCT
cid, pid
FROM
Purchase) AS Temp

install hunspell

brew install hunspell find the dictionary

en dictionary

then move dictionary to ~/Library/Spelling, thus hunspell can find it. using hunspell -D list search directories.

@zarzen
zarzen / install.md
Created December 21, 2016 21:22
YCMD installation

Install vim vundle

git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim

config vimrc

add following into ~/.vimrc

set nocompatible              " be iMproved, required
filetype off                  " required

" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
@zarzen
zarzen / ovs-example.md
Last active December 29, 2023 07:09
ovs example

install openvswitch 2.4

uninstall ovs-2.5

sudo apt autoremove  openvswitch-common openvswitch-switch-dpdk openvswitch-dbg openvswitch-pki openvswitch-ipsec openvswitch-switch openvswitch-switch-dpdk openvswitch-ipsec openvswitch-test openvswitch-testcontroller openvswitch-vtep

download source code

wget http://openvswitch.org/releases/openvswitch-2.4.0.tar.gz

unpack and compile

@zarzen
zarzen / send-packet.py
Last active November 12, 2021 04:01
using scapy create tcp packet and catch it by wireshark
from scapy.all import *
def main():
"""
"""
packet = IP(dst="192.168.100.123")/TCP()/"from scapy packet"
send(packet)
def packet_with_seq_n():
@zarzen
zarzen / sniffer.py
Last active November 28, 2017 19:45
sniff a specific interface
from scapy.all import *
import atexit
#
packet_stats = {}
def print_stats():
print("\npacket statistics")
print(packet_stats)
@zarzen
zarzen / AnnotatedReview.py
Last active April 11, 2017 05:27
Annotate Data
class AnnotatedReview:
def __init__(self, sentence, feature_list, opinion_list):
self.sentence = sentence
self.feature_list = feature_list
self.opinion_list = opinion_list
def __str__(self):
return self.sentence
def __repr__(self):
@zarzen
zarzen / change_pixel.py
Created August 23, 2017 15:19
change_pixel
import scipy.misc
def change_pixel(img, new_name):
"""
Args: img, numpy array
Returns:
new_img