Skip to content

Instantly share code, notes, and snippets.

View zhangtemplar's full-sized avatar

Qiang Zhang zhangtemplar

View GitHub Profile
@zhangtemplar
zhangtemplar / zotero_arxiv.js
Created June 18, 2023 22:13
Automatically link arxiv pdf in zotero
var arxiv_url_pattern = "arxiv.org/abs/";
const LINK_MODE_LINKED_URL = 3;
var s = new Zotero.Search();
s.libraryID = ZoteroPane.getSelectedLibraryID();
s.addCondition('url', 'contains', arxiv_url_pattern);
var ids = await s.search();
if (!ids.length) {
return "No items found";
} else {
Zotero.warn("Find " + ids.length + " items");
@zhangtemplar
zhangtemplar / schema.md
Last active March 3, 2019 16:38
数据格式

数据格式

2.0考虑所有的entity,比如userproject,采用collection entity来表示:

字段 类型 可选 说明
name string 真实名字,不能为空
nick string 显示名字
addr address 地址
contact contact 联系方式
@zhangtemplar
zhangtemplar / japan.py
Created February 19, 2019 16:22
This code extracts the approved medical device and drug from Japan Pmda - Pharmaceuticals and Medical Devices Agency. https://www.pmda.go.jp/english/review-services/reviews/approved-information/devices/0001.html Requirement: - tabula for parsing table from pdf - openpyxl for writing excel - java for running tabula
# coding=utf-8
__author__ = "Qiang Zhang"
__maintainer__ = "Qiang Zhang"
__email__ = "zhangtemplar@gmail.com"
"""
Add documentation of this module here.
"""
import json
import os
@zhangtemplar
zhangtemplar / middlewares.py
Created February 12, 2019 02:34
Change to scrapy_selenium to allow change proxy for each SeleniumRequest.
"""This module contains the ``SeleniumMiddleware`` scrapy middleware"""
from importlib import import_module
from scrapy import signals
from scrapy.exceptions import NotConfigured
from scrapy.http import HtmlResponse
from selenium.webdriver.support.ui import WebDriverWait
from .http import SeleniumRequest
@zhangtemplar
zhangtemplar / instagram.py
Created February 8, 2018 18:39
Download video from instagram given a hashtag
"""
This script crawl the videos from instagram for a given url.
"""
from selenium import webdriver
import os
import time
import random
from sets import Set
@zhangtemplar
zhangtemplar / Dockerfile
Last active October 26, 2017 05:49 — forked from tribou/Dockerfile
FROM node
MAINTAINER zhangtemplar
# Prepare app directory
RUN mkdir -p /usr/src/app
ADD . /usr/src/app
# Install dependencies
WORKDIR /usr/src/app
RUN npm install
@zhangtemplar
zhangtemplar / mysql2sqlite.sh
Last active August 21, 2017 01:46 — forked from esperlu/mysql2sqlite.sh
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump.sql | sqlite3 database.sqlite