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 / 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
View gitlab_ci_navigate.go
package main
import (
"encoding/gob"
"encoding/json"
"fmt"
"os"
"strings"
"sync"
@ficapy
ficapy / proxy_dns.go
Created Dec 19, 2017
对特定域名根据内网域名是否可以访问返回特定的ip
View proxy_dns.go
package main
import (
"log"
"net"
"os"
"os/signal"
"syscall"
"time"
@ficapy
ficapy / paramiko_with_tty.py
Created Dec 12, 2017
paramiko_with_tty demo
View paramiko_with_tty.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
# Create: '12/12/2017'
import os
import threading
from paramiko import SSHConfig, SSHClient, AutoAddPolicy
HOSTNAME = 'aliyun'
@ficapy
ficapy / .env
Created Oct 10, 2017
sentry docker-compse
View .env
POSTGRES_USER=sentry
POSTGRES_PASSWORD=sentry
POSTGRES_DBNAME=sentry
SENTRY_SECRET_KEY=CHANGEME
SENTRY_REDIS_HOST=redis
SENTRY_POSTGRES_HOST=postgres
SENTRY_DB_USER=sentry
SENTRY_DB_PASSWORD=sentry
@ficapy
ficapy / bearychat_websocket.py
Created Sep 7, 2017
使用websocket和bearychat进行长连接。当服务器接收到消息后执行动作返回消息
View bearychat_websocket.py
import re
import json
from urllib.parse import urlencode
from config import BEARYCHAT_TOKEN
from tornado.ioloop import IOLoop, PeriodicCallback
from tornado.httpclient import AsyncHTTPClient
from tornado import gen
from tornado.websocket import websocket_connect
@ficapy
ficapy / tornado_db.py
Created Aug 1, 2017
tornado 数据库操作
View tornado_db.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
import threading
import functools
import tornado.ioloop
import tornado.web
from sqlalchemy import Column, create_engine
from sqlalchemy.dialects.mysql import INTEGER, BIT, VARCHAR
from sqlalchemy.ext.declarative import declarative_base
@ficapy
ficapy / optimistic_lock.py
Created Jun 15, 2017
乐观锁和悲观锁以及事物隔离级别
View optimistic_lock.py
# !/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
import time
import threading
from threading import Thread
from sqlalchemy import create_engine, Column, Integer
from sqlalchemy.orm import sessionmaker
from sqlalchemy.ext.declarative import declarative_base
@ficapy
ficapy / sqlalchemy_test.py
Created Jun 2, 2017
namedtuple搭配sqlalchemy进行测试
View sqlalchemy_test.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: ficapy
# Create: '5/25/17'
import inspect
from datetime import datetime
from sqlalchemy import inspection
from collections import namedtuple
from sqlalchemy import create_engine, Column, Integer, String, DateTime
You can’t perform that action at this time.