Skip to content

Instantly share code, notes, and snippets.

import collections
import kibanautils
import datetime
import pandas
def df_to_redash(df_orig, index_to_col=False):
import numpy as np
df = df_orig.copy()
if index_to_col:
df.reset_index(inplace=True)
import os
def timer_log():
os.system("kubectl -n fission get pods | grep timer | awk {'print $1'} > /tmp/a.log")
with open("/tmp/a.log") as fin:
cmd_list = []
cmd_pod_dict = {}
for line in fin:
pods = line.strip()
os.system("kubectl -n fission logs --tail 100 "+pods+" > /tmp/b.log")
with open("/tmp/b.log") as fin2:
docker run -it --rm -p 43010:43010 -v "$PWD":/mnt namsangboy/mask-rcnn /bin/bash -c "cd /mnt;cp /root/Mask_RCNN/samples/demo.ipynb /mnt/;jupyter notebook --ip=0.0.0.0 --allow-root --port=43010"
import re
import itertools
from bs4 import BeautifulSoup
import requests
import scrapy
def xpath_soup(element):
"""
Generate xpath from BeautifulSoup4 element
:param element: BeautifulSoup4 element.
import sys
from keras.applications.mobilenet import MobileNet
import numpy as np
from keras.preprocessing import image
model = MobileNet(weights='imagenet')
from keras.applications.imagenet_utils import preprocess_input, decode_predictions
img_path = '1543513007_B.jpg'
get_ipython().magic('pinfo image.load_img')
img = image.load_img(img_path, target_size=(224, 224))
x = image.img_to_array(img)
#coding:utf-8
import numpy as np
from bottle import route, run, request
import os
import sys
@route('/add')
def get_similar_user():
name = request.GET.get('name', '')
import importlib, sys
def reload_all(top_module, max_depth=20):
module_type = type(importlib) # get the 'module' type
for_reload = dict() # modules to reload: K=module, V=depth
def trace_reload(module, depth): # recursive
# nonlocal for_reload
depth += 1
if type(module) == module_type and depth < max_depth:
#coding:utf-8
import requests
from scrapy.selector import HtmlXPathSelector
u = 'http://mw.cjmall.com/m/oclock/oclockIndex.jsp?app_cd=HMOATV'
u = 'flash.cloudvine.io/1004/etc/85_1_541194e0082e4.json?tsFlash=cfile2.cloudvine.io'
u = 'http://flash.cloudvine.io/1004/etc/85_1_541194e0082e4.json?tsFlash=cfile2.cloudvine.io'
u = 'http://www.nsmall.com/jsp/etv/shopping.jsp'
def cj_test():
_MOBILE_HEADER = {
'User-Agent': 'Mozilla/5.0 (Linux; Android 4.1.1; Nexus 7 Build/JRO03D) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19'}
url = require "net.url"
local async = require 'async'
require('pl.text').format_operator()
require 'neuralconvo'
local tokenizer = require "tokenizer"
local list = require "pl.List"
local options = {}
#!/bin/bash
ES='http://deep3.buzzni.net:9200'
ESIDX='search_info'
ESTYPE='query'
curl -XDELETE $ES/$ESIDX
curl -XPUT $ES/$ESIDX/ -d '{