Instantly share code, notes, and snippets.

import json
import spacy
import string
import re
from nltk.tokenize.stanford_segmenter import StanfordSegmenter
from nltk.tokenize import sent_tokenize
def remove_nonascii(document):
printable = set(string.printable)
# Turn a Unicode string to plain ASCII, thanks to
def unicodeToAscii(s):
return ''.join(
c for c in unicodedata.normalize('NFD', s)
if unicodedata.category(c) != 'Mn'
View android-perm-desc.json
"find accounts on the device": "Allows the app to get the list of accounts known by the device. This may include any accounts created by applications you have installed.",
"read your text messages (sms or mms)": "Allows the app to read SMS messages stored on your device or SIM card. This allows the app to read all SMS messages, regardless of content or confidentiality.",
"receive text messages (sms)": "Allows the app to receive and process SMS messages. This means the app could monitor or delete messages sent to your device without showing them to you.",
"send sms messages": "Allows the app to send SMS messages. This may result in unexpected charges. Malicious apps may cost you money by sending messages without your confirmation.",
"edit your text messages (sms or mms)": "Allows the app to write to SMS messages stored on your device or SIM card. Malicious apps may delete your messages.",
"read the contents of your usb storage": "Allows the app to read the contents of your USB storage.",
import sqlite3
from sqlite3 import Error
from tqdm import tqdm
import requests
import urllib.request
from pyquery import PyQuery as pq
from os.path import join
from requests import HTTPError
import time
import scipy.misc
def change_pixel(img, new_name):
Args: img, numpy array
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):
from scapy.all import *
import atexit
packet_stats = {}
def print_stats():
print("\npacket statistics")
from scapy.all import *
def main():
packet = IP(dst="")/TCP()/"from scapy packet"
def packet_with_seq_n():

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


unpack and compile


Install vim vundle

git clone ~/.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