Skip to content

Instantly share code, notes, and snippets.

@yetone
yetone / README-Template.md
Created November 16, 2018 07:44 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

@yetone
yetone / Dockerfile
Last active June 15, 2018 10:36
compile jdk
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y wget gcc g++ make ant gawk libcups2-dev libfreetype6-dev libxtst-dev libxrender-dev cpio X11* python-software-properties software-properties-common
RUN apt-get install -y vim
RUN apt-get install -y zip unzip libasound2-dev
RUN apt-get install -y aria2
RUN mkdir -p /usr/lib/jvm && cd /usr/lib/jvm && aria2c -x4 http://bridsys.com/downloads/java/jdk-6u45-linux-x64.bin && \
chmod a+x ./jdk-6u45-linux-x64.bin && ./jdk-6u45-linux-x64.bin
RUN ln -sf -b /usr/lib/jvm/jdk1.6.0_45/jre/bin/java /etc/alternatives/java && ln -sf -b /usr/lib/jvm/jdk1.6.0_45/jre/bin/java /usr/bin/java
@yetone
yetone / !.md
Last active January 19, 2018 08:12
Carbon to SVG
@yetone
yetone / who-weibo.js
Created January 15, 2018 02:33 — forked from zh-h/who-weibo.js
是谁发的微博微博图片
function decodeBase62(number) {
var alphabet = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
var out = 0
var len = number.length - 1
for (var t = 0; t <= len; t++) {
out = out + alphabet.indexOf(number.substr(t, 1)) * Math.pow(62, len - t)
}
return out
}
@yetone
yetone / .pylintrc
Created December 11, 2017 02:30 — forked from xen/.pylintrc
[MASTER]
# Specify a configuration file.
#rcfile=
# Python code to execute, usually for sys.path manipulation such as
# pygtk.require().
#init-hook=
# Profiled execution.
@yetone
yetone / svm.py
Created July 24, 2017 10:38 — forked from mblondel/svm.py
Support Vector Machines
# Mathieu Blondel, September 2010
# License: BSD 3 clause
import numpy as np
from numpy import linalg
import cvxopt
import cvxopt.solvers
def linear_kernel(x1, x2):
return np.dot(x1, x2)
@yetone
yetone / svm.py
Created July 24, 2017 10:38 — forked from mblondel/svm.py
Support Vector Machines
# Mathieu Blondel, September 2010
# License: BSD 3 clause
import numpy as np
from numpy import linalg
import cvxopt
import cvxopt.solvers
def linear_kernel(x1, x2):
return np.dot(x1, x2)
@yetone
yetone / waifu2x.py
Created June 26, 2017 03:08 — forked from Tydus/waifu2x.py
waifu2x in 15 lines of Python by @marcan42
import json, sys, numpy as np
from scipy import misc, signal
from PIL import Image
infile, outfile, modelpath = sys.argv[1:]
model = json.load(open(modelpath))
im = Image.open(infile).convert("YCbCr")
im = misc.fromimage(im.resize((2*im.size[0], 2*im.size[1]), resample=Image.NEAREST)).astype("float32")
planes = [np.pad(im[:,:,0], len(model), "edge") / 255.0]
for step in model:
o_planes = [sum([signal.convolve2d(ip, np.float32(kernel), "valid")
@yetone
yetone / README.md
Created April 26, 2017 13:34 — forked from xaviervia/README.md
Sketch 43 files JSON types
@yetone
yetone / python-monkey-patch-built-ins.py
Created April 10, 2017 07:39 — forked from mahmoudimus/python-monkey-patch-built-ins.py
pythonic monkey patching built-in types
# found this from Armin R. on Twitter, what a beautiful gem ;)
import ctypes
from types import DictProxyType, MethodType
# figure out side of _Py_ssize_t
if hasattr(ctypes.pythonapi, 'Py_InitModule4_64'):
_Py_ssize_t = ctypes.c_int64
else:
_Py_ssize_t = ctypes.c_int