Skip to content

Instantly share code, notes, and snippets.

Stratum挖矿协议: 该协议是由SlushPool制定的,请参阅其官方文档:https://slushpool.com/help/manual/stratum-protocol

以下所有报文均使用\n做为行结束符。


矿机订阅:

{"id": 1, "method": "mining.subscribe", "params": []}
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
git config --global --unset http.proxy
git config --global --unset https.proxy
npm config delete proxy
@smallsong
smallsong / check_image.py
Created April 15, 2020 09:06 — forked from tmpbook/check_image.py
Pull 4254 docker images and delete them by python | 并发拉取镜像,记录拉取成功、失败、超时的情况
#!/usr/bin/env python
#-*- coding: utf-8 -*-
import os
import sys
import datetime
import subprocess
import time
import gevent.pool
import gevent.monkey
@smallsong
smallsong / pubsub.py
Created April 15, 2020 03:50 — forked from appeltel/pubsub.py
asyncio pubsub example
import asyncio
import random
class Hub():
def __init__(self):
self.subscriptions = set()
def publish(self, message):
@smallsong
smallsong / PyQt2WayBinding
Created April 14, 2020 07:18 — forked from jkokorian/PyQt2WayBinding
PyQt observer class for 2-way binding
import PyQt4.QtCore as q
import PyQt4.QtGui as qt
class BindingEndpoint(object):
"""
Data object that contains the triplet of: getter, setter and change notification signal,
as well as the object instance and it's memory id to which the binding triplet belongs.
Parameters:
instance -- the object instance to which the getter, setter and changedSignal belong
@smallsong
smallsong / quick-check.py
Created December 19, 2019 02:50 — forked from ameesters/quick-check.py
A python script that checks multiple websites status.
#!/usr/bin/env python
import os, time, httplib
from termcolor import colored
SITES = [
"www.meesters-id.nl",
"www.carolsingers.nl",
]
while 1:
@smallsong
smallsong / worker-threadpool.py
Created October 25, 2019 06:20 — forked from ksvbka/worker-threadpool.py
Demo worker threadpool and report progress in PyQT.
from PyQt5.QtWidgets import QApplication, QMainWindow, QLabel, QVBoxLayout, QPushButton, QWidget
from PyQt5.QtCore import QObject, QRunnable, QThreadPool,pyqtSlot, pyqtSignal
import time
import traceback, sys
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
@smallsong
smallsong / gist:866bc4600562a49708bf8ce68ad0a1ef
Created July 20, 2019 03:41 — forked from nanchenzi/gist:3951177
Bloom Filter --- java简单实现
/*布隆过滤器(Bloom Filter)是1970年由Burton Howard Bloom提出的。
*它实际上是一个很长的二进制向量和一系列随机映射函数。
*布隆过滤器可以用于检索一个元素是否在一个集合中。
*它的优点是空间效率和查询时间都远远超过一般的算法,缺点是有一定的误识别率和删除困难。
*/
import java.util.BitSet;
public class SimpleBloomFilter {

Angular Universal (Webpack bundle + Docker deploy)

Tested with angular@5.

Install deps

npm i @angular/platform-server @nguniversal/express-engine @nguniversal/module-map-ngfactory-loader express @types/express ts-loader@3 rimraf --save-dev

Update src/app/app.module.ts

package com.empireminecraft.util;
import org.bukkit.Bukkit;
import java.util.concurrent.ConcurrentLinkedQueue;
public class TaskChain {
// Tells a task it will perform call back later.
public static final Object WAIT = new Object();