Skip to content

Instantly share code, notes, and snippets.

ficapy ficapy

Block or report user

Report or block ficapy

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ficapy
ficapy / phash.py
Last active May 12, 2019
将phash得到的64位数据转换成bigint方便存储到数据库
View phash.py
from PIL import Image
import imagehash
def get_phash(file_path):
img = Image.open(file_path)
phash = imagehash.phash(img).hash.flatten()
phash_list = list(map(bool, phash))
if phash_list[0] is True:
View show_polygon.py
from shapely.geometry import Polygon
from matplotlib import pyplot as plt
from shapely.ops import cascaded_union
import geopandas as gpd
m = cascaded_union([Polygon(i if i[0] == i[-1] else i[:-2].append(i[0])) for i in [
[
[81.300003051757812, 37.588695526123047],
[75.599998474121094, 37.588695526123047],
[75.599998474121094, 39.888694763183594],
@ficapy
ficapy / sqlalchemy_dict.py
Last active Mar 8, 2019
让sqlalchemy返回的结果为字典
View sqlalchemy_dict.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
from sqlalchemy import create_engine, Column, BIGINT
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
sqlalchemy_db = 'sqlite://'
View oss_letsencrypt.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/3/4'
# !/usr/bin/env python
import ftplib
import hmac
import subprocess, json, base64, binascii, time, hashlib, re, copy, textwrap
View linear_algebra.py
import numpy as np
np.array([8.218,-9.341]) + np.array([-1.129,2.111])
np.array([7.119,8.215]) - np.array([-8.223,0.878])
7.41 * np.array([1.671,-1.012,-0.318])
@ficapy
ficapy / pycallgraph.py
Last active Apr 29, 2018
精简pycallgraph代码,生成调用关系图 python3.5.1 代码解读https://ficapy.github.io/2016/07/22/pycallgraph_note/
View pycallgraph.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '20/7/2016'
import inspect
import os
import re
import tempfile
import textwrap
import pkgutil
@ficapy
ficapy / img_upload.py
Last active Apr 9, 2018
当做图床使用,读取粘贴板的图像保存上传,完成后将url地址写入到剪贴板
View img_upload.py
#!/usr/local/bin/python2
# -*- coding: utf-8 -*-
# Author: Ficapy
# Create: '16/1/1'
import datetime
import os
import sys
import atexit
import requests
View thread_lock.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
# Create: '12/03/2018'
from threading import Lock, get_ident
class RLock:
@ficapy
ficapy / bk_tree.py
Last active Mar 4, 2018
BK树和VP树
View bk_tree.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
# Create: '03/03/2018'
import random
from string import ascii_lowercase
def distance(str1: str, str2: str):
@ficapy
ficapy / single_vs_batch_update.py
Created Dec 27, 2017
Postgresql 批量更新对比单条更新
View single_vs_batch_update.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
import random
import csv
import time
from functools import wraps
from io import StringIO
from contextlib import closing, contextmanager
You can’t perform that action at this time.