Skip to content

Instantly share code, notes, and snippets.

View bingoabs's full-sized avatar

Joe Zhou bingoabs

  • China
  • 11:29 (UTC -12:00)
View GitHub Profile
@bingoabs
bingoabs / min-char-rnn.py
Created January 2, 2023 11:38 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@bingoabs
bingoabs / tornado_asyncio.py
Created February 12, 2019 06:12 — forked from drgarcia1986/tornado_asyncio.py
Tornado and Asyncio Mixed example
# -*- coding: utf-8 -*-
import asyncio
import re
import asyncio_redis
import tornado.concurrent
import tornado.httpclient
import tornado.web
import tornado.platform.asyncio
@bingoabs
bingoabs / upgrade.md
Created July 28, 2017 02:23 — forked from chrismccord/upgrade.md
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@bingoabs
bingoabs / upgrade.md
Created July 28, 2017 02:23 — forked from chrismccord/upgrade.md
Phoenix 1.2.x to 1.3.0 Upgrade Instructions

If you want a run-down of the 1.3 changes and the design decisions behidn those changes, check out the LonestarElixir Phoenix 1.3 keynote: https://www.youtube.com/watch?v=tMO28ar0lW8

To use the new phx.new project generator, you can install the archive with the following command:

$ mix archive.install https://github.com/phoenixframework/archives/raw/master/phx_new.ez

Bump your phoenix dep

Phoenix v1.3.0 is a backwards compatible release with v1.2.x. To upgrade your existing 1.2.x project, simply bump your phoenix dependency in mix.exs:

@bingoabs
bingoabs / result.sh
Created June 6, 2017 02:44 — forked from gunesmes/result.sh
Testing SOAP services, I used Python requests library to test the SOAP services. What I did is just creating a form variable within a triple-double quotes for Python docstring, like """this is triple-double quotes with V1: %s and V2: %s""" %(variable-1, variable-2) . At the end I am just calling requests.post method with sending url, headers, da…
~/P/m/h/services python run.py
test_get_session (__main__.SoapServices) ... ok
test_get_token (__main__.SoapServices) ... ok
test_CompleteReturnRequest (__main__.SoapServices) ... ok
test_ReturnTransactionRequest (__main__.SoapServices) ... ok
test_UserInfoRequest (__main__.SoapServices) ... ok
test_RefundRequest (__main__.SoapServices) ... ok
test_StartTransactionRequest (__main__.SoapServices) ... ok
test_ReturnTransactionRequest (__main__.SoapServices) ... ok
@bingoabs
bingoabs / guardian_gaza.ipynb
Created March 29, 2017 15:15 — forked from darribas/guardian_gaza.ipynb
A IPython Notebook to analyze the Gaza-Israel 2012 crisis
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bingoabs
bingoabs / Unit.md
Created November 24, 2016 12:04 — forked from JeOam/Unit.md
Unit Test Notes

unittest — Unit testing framework

The Python unit testing framework, sometimes referred to as “PyUnit”.

unittest supports test automation, sharing of setup and shutdown code for tests, aggregation of tests into collections, and independence of the tests from the reporting framework. The unittest module provides classes that make it easy to support these qualities for a set of tests.

To achieve this, unittest supports some important concepts:

  • test fixture
    • A test fixture represents the preparation needed to perform one or more tests, and any associate cleanup actions. This may involve, for example, creating temporary or proxy databases, directories, or starting a server process.
  • test case
@bingoabs
bingoabs / tic-tac-toe.py
Created May 18, 2016 10:35 — forked from kachayev/tic-tac-toe.py
Tornado demo application: TCP server to tic-tac-toe multiplayer game
"""Simple TCP server for playing Tic-Tac-Toe game.
Use Player-to-Player game mode based on naming auth.
No thoughts about distribution or pub/sub mode
(for monitoring or something like this). Just
basic functionality.
"""
import time
import logging
@bingoabs
bingoabs / py.py
Created March 4, 2016 05:48
python interview questions
# encoding: utf8
# 什么是lambda函数?它有什么好处?另外python在函数式编程方面提供了些什么函数和语法?
# - lambda 就是匿名函数
# - 好处: 可以动态生成一个函数对象,不用给这个对象命名,污染名字空间
# - 函数:map()/filter()
# - 语法:可以函数内部定义函数,闭包支持
# 详细说说tuple、list、dict的用法,它们的特点;
# - tuple 固定长度的子项不可变的顺序型容器,一般用来做常量(策划配表)或者表示少量属性的对象(比如pos)表示