Skip to content

Instantly share code, notes, and snippets.

@filwaline
filwaline / readme.md
Last active April 20, 2023 15:48
install pg12 with pigsty-2.0.2
@filwaline
filwaline / full-comb.py
Created February 23, 2023 16:00
full comb
def _comb_1(last_subsets, elem, head, rest, full_result, current_subsets):
new_subset = list(sorted(set(elem + head)))
if new_subset not in full_result:
full_result = full_result + [new_subset]
current_subsets = current_subsets + [new_subset]
if rest:
return _comb_1(
@filwaline
filwaline / gist:64b3f59feb819e6b337d685d55433483
Last active September 20, 2022 07:27
primes_generator.py
def numbers(start=0):
num = start
while True:
yield num
num += 1
def primes(seq):
num = next(seq)
@filwaline
filwaline / websocket_retry.py
Last active November 25, 2020 09:41
websockets client retry attempts
# Standard Library
import asyncio
import random
# Third Party Library
import websockets
from websockets.exceptions import ConnectionClosedError, ConnectionClosedOK
class WebSocketRetry:
@filwaline
filwaline / learning rate.py
Last active January 26, 2022 05:12
模拟学习率影响模型收敛的简化示例
import numpy as np
import random
import matplotlib.pyplot as plt
from matplotlib import animation
################################
# 修改这个alpha玩!其他代码不需要动!
# 这个示意的例子跟真实ML不一样,alpha通常在0.001到0.1之间