Skip to content

Instantly share code, notes, and snippets.

@codehwang
codehwang / pylint-rgx.md
Created November 27, 2017 06:33
PyLint Default regular expression

Type Option Default regular expression Argument argument-rgx [a-z_][a-z0-9_]{2,30}$ Attribute attr-rgx [a-z_][a-z0-9_]{2,30}$ Class class-rgx [A-Z_][a-zA-Z0-9]+$ Constant const-rgx (([A-Z_][A-Z0-9_])|(__.__))$ Function function-rgx [a-z_][a-z0-9_]{2,30}$ Method method-rgx [a-z_][a-z0-9_]{2,30}$ Module module-rgx (([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$ Variable variable-rgx [a-z_][a-z0-9_]{2,30}$

@codehwang
codehwang / wget-alias.terminal
Created November 27, 2017 03:01 — forked from philiparthurmoore/wget-alias.terminal
Using a wget alias on Mac OS X
alias wget="curl -O --retry 999 --retry-max-time 0 -C -"
##
# Line should be placed at ~/.bash_profile
# Source: http://www.mymacosx.com/terminal/wget-replacement-macos.html
# Source: http://superuser.com/questions/142459/persistent-retrying-resuming-downloads-with-curl
##
@codehwang
codehwang / cv2install.md
Last active November 24, 2017 19:10
installing and using cv2 in python

just type

pip install opencv-python

in python

import cv2

@codehwang
codehwang / text2png.py
Created November 22, 2017 15:31 — forked from destan/text2png.py
Python text to image (png) conversion with automatic new line calculation
# coding=utf8
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
def text2png(text, fullpath, color = "#000", bgcolor = "#FFF", fontfullpath = None, fontsize = 13, leftpadding = 3, rightpadding = 3, width = 200):
REPLACEMENT_CHARACTER = u'\uFFFD'
NEWLINE_REPLACEMENT_STRING = ' ' + REPLACEMENT_CHARACTER + ' '
@codehwang
codehwang / snakecoin-server-full-code.py
Created November 20, 2017 16:39 — forked from aunyks/snakecoin-server-full-code.py
The code in this gist isn't as succinct as I'd like it to be. Please bare with me and ask plenty of questions that you may have about it.
from flask import Flask
from flask import request
import json
import requests
import hashlib as hasher
import datetime as date
node = Flask(__name__)
# Define what a Snakecoin block is
class Block:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.