Skip to content

Instantly share code, notes, and snippets.

scturtle

Block or report user

Report or block scturtle

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
@scturtle
scturtle / gevent.py
Last active Sep 17, 2019
Let's go HTTPS!
View gevent.py
from gevent import monkey
monkey.patch_all()
import bottle
class SSLWebServer(bottle.ServerAdapter):
def run(self, handler):
from gevent.pywsgi import WSGIServer
srv = WSGIServer((self.host, self.port), handler,
certfile='/etc/letsencrypt/live/XXX/fullchain.pem',
View interactive.py
import cv2
import numpy as np
canny = rho = threshold = minLen = maxGap = None
def draw():
lines = cv2.HoughLinesP(canny, rho, np.pi / 180,
threshold, None, minLen, maxGap)
dst = cv2.cvtColor(canny, cv2.COLOR_GRAY2BGR)
View wechat2txt.py
import os
import sys
import re
import hashlib
import csv
import time
import locale
import getopt
@scturtle
scturtle / server.py
Last active Aug 4, 2019
python socks5 proxy server with asyncio (async/await)
View server.py
#!/usr/bin/env python3.5
import socket
import asyncio
from struct import pack, unpack
class Client(asyncio.Protocol):
def connection_made(self, transport):
self.transport = transport
self.server_transport = None
@scturtle
scturtle / c2a.py
Created Jul 5, 2019
curl to aria2
View c2a.py
#!/usr/bin/env python
import sys
cmd = "aria2c --no-conf '{}'".format(sys.argv[2])
i = 3
while i < len(sys.argv):
arg = sys.argv[i]
i += 1
if arg == '-H':
arg = sys.argv[i]
View colorlog.py
import logging
class ColoredFormatter(logging.Formatter):
def __init__(self, fmt, datefmt=None):
logging.Formatter.__init__(self, fmt, datefmt)
BLACK, RED, GREEN, YELLOW, BLUE, MAGENTA, CYAN, WHITE = range(30, 38)
self.COLORS = dict(
DEBUG=GREEN, INFO=WHITE, WARNING=YELLOW, ERROR=RED, CRITICAL=MAGENTA
)
@scturtle
scturtle / ftpserver.py
Created Jun 20, 2011
simple ftp server by python
View ftpserver.py
#!/usr/bin/env python2
# coding: utf-8
import os,socket,threading,time
#import traceback
allow_delete = False
local_ip = socket.gethostbyname(socket.gethostname())
local_port = 8888
currdir=os.path.abspath('.')
@scturtle
scturtle / index.html
Last active Jun 5, 2019
simple vue template with element-ui
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Welcome to Vue</title>
<script src="https://cdn.bootcss.com/vue/2.6.10/vue.min.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.7.2/index.js"></script>
<script src="https://cdn.bootcss.com/element-ui/2.7.2/locale/zh-CN.min.js"></script>
<link href="https://cdn.bootcss.com/element-ui/2.7.2/theme-chalk/index.css" rel=stylesheet>
</head>
@scturtle
scturtle / tf.ipynb
Created Feb 19, 2016
multiclass classification using tensorflow
View tf.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@scturtle
scturtle / ast_dump.py
Created Dec 16, 2017
Dump Clang AST with python bindings.
View ast_dump.py
#!/usr/bin/env python3
import sys
import clang.cindex
INDENT = 4
K = clang.cindex.CursorKind
def is_std_ns(node):
return node.kind == K.NAMESPACE and node.spelling == 'std'
You can’t perform that action at this time.