Skip to content

Instantly share code, notes, and snippets.

View RyanKung's full-sized avatar
🏠
Working from home

Elder Ryan RyanKung

🏠
Working from home
View GitHub Profile
@RyanKung
RyanKung / Prelude.hs
Created September 8, 2017 06:23
Prelude of MakerDao purple book
{-# LANGUAGE NoImplicitPrelude, UnicodeSyntax #-}
module Maker.Prelude (module Maker.Prelude, module X) where
import Prelude.Unicode as X ((¬), (∧), (⊥))
import Prelude as X (
-- Conversion to and from strings
Read(..), Show(..), read,
import logging
from pulsar.apps import http
import requests
from bs4 import BeautifulSoup
import random
class Request():
def __init__(self, https=True, timeout=3):
self.https = True
@RyanKung
RyanKung / maybe_coroutine.py
Created July 17, 2017 02:23
a decorator of `maybe coroutine`
from typing import Union, Callable, Generic, GenericMeta, TypeVar
from types import CoroutineType
from asyncio import iscoroutinefunction
from functools import wraps
from asyncio import coroutine
from typing import Callable, Any
MaybeCorouteine = Union[CoroutineType, Callable]
Handler = Callable[..., WsgiResponse]
@RyanKung
RyanKung / demo.py
Created April 13, 2017 16:03
Call py2 code in py3
import asyncio
import sys
from typing import Coroutine
from functools import partial
python = "/usr/local/bin/python2"
exec_file = "pipeWeed/tests/py2code.py"
if sys.platform == "win32":
@RyanKung
RyanKung / build.sh
Last active November 22, 2017 10:34
Cross-compiling netcat for blackberry 10 (QNX)
#! /bin/sh
# 1. Download source file of netcat from http://netcat.sourceforge.net/ and unzip it.
# 2. Path to source, and run the build shell.
tmp_pwd=`pwd`
cd /Applications/Momentics.app && source bbndk-env_10_3_1_995.sh && cd $tmp_pwd
QoX_BINS="${QNX_HOST}/usr/bin"
@RyanKung
RyanKung / _wget.md
Created March 6, 2017 10:57 — forked from Paxa/_wget.md
Cross-compiling wget for blackberry 10 (QNX)

How to compile wget for blackberry 10

Prepare

  1. Download from here http://ftp.gnu.org/gnu/wget/
  2. Extract sources archive, (using extract for example)
  3. Or run tar xf wget-1.15.tar.xz
  4. Copy file bb10_compile from this gist to source folder

Compile

@RyanKung
RyanKung / mt4.el
Created January 25, 2017 09:51
simple Emacs major-mode implementation for metatrader4 editor
;;; mt4.el ---- major-mode for metatrader 4
;; Copyright (c) 2017 Ryan Kung
;; Author: Ryan Kung <[email protected]>
;; Keywords: metatrader mt4 mql4
;;; Commentary:
;;; Code:
(defvar mql-compiler
"wine '/Users/xxxx/Applications/Wineskin/MetaTrader 4.app/drive_c/Program Files/BTC-e Exchange MT4/metaeditor.exe'")
@RyanKung
RyanKung / mypy.el
Last active July 5, 2016 11:52
mypy backend plugin for flymake, do play with mypy !!
;;; mypy.el --- mypy plugin for flymake
;;; Commentary:
;;; Code:
(require 'flymake)
(defun flymake-mypy-init ()
@RyanKung
RyanKung / gravatar.el
Created April 20, 2016 17:12 — forked from iratqq/gravatar.el
gravatar for gnus
;;; gravatar.el --- gravatar fetch/store functions
;; Copyright (C) 2008 Iwata
;; Author: Iwata <[email protected]>
;; Keywords: faces, tools, extensions, mail
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
@RyanKung
RyanKung / init.el
Last active March 31, 2016 07:48
my emacs config
;;; init --- init
;;; Commentary:
;;; Code:
(package-initialize)
(require 'cl)
;;(setq debug-on-error t)