Skip to content

Instantly share code, notes, and snippets.

View yozx's full-sized avatar
🎀
Duck Typing

Z yozx

🎀
Duck Typing
View GitHub Profile
@yozx
yozx / gist:a1761ef5679905979ece2083463153bd
Last active February 17, 2020 12:59
compute over dict
# generate data
data = {f'p_{_}': _ * 2 for _ in range(0, 16, 2)}
def compute(data, verbose=False):
condition = 'v*2 > 9'
result = {k: (v * 2 - 9, f'{v * 2} ({v}*2) > 9 {eval(condition)}')
if eval(condition) else (v * 2, False) for (k, v) in data.items()}
if not verbose:
@yozx
yozx / seek_and_tell_basic_example.py
Created April 13, 2020 12:23
seek_and_tell_basic_example
from typing import List, Optional, Any
from dataclasses import dataclass
from random import randint
from datetime import datetime, timezone
import logging
logging.basicConfig()
logger = logging.getLogger('seek_and_tell_app')
logger.setLevel(logging.DEBUG)
@yozx
yozx / proxy.txt
Created April 15, 2020 20:27
telegram_proxy_checker
101.83.41.28:1080
121.40.66.129:1080
117.27.12.214:1080
119.146.131.247:8080
120.236.253.250:1081
120.236.253.116:1081
114.67.71.90:1080
47.100.106.114:50893
47.100.106.114:56826
106.14.222.35:49249
#!/usr/bin/env bash
function miner_fork() {
local MINER_FORK=$ETHMINER_FORK
[[ -z $MINER_FORK ]] && MINER_FORK=$MINER_DEFAULT_FORK
echo $MINER_FORK
}
function miner_ver() {
@yozx
yozx / input.txt
Last active May 18, 2020 17:01
Finding some of two with/without doubles
67
5 100 200 30 56 456 4 37 44 38 5 9999 2 44 89 100 5435 324
@yozx
yozx / bitly_shorten_app.py
Created July 12, 2020 18:11
bitly_shorten_async
# Non-blocking script for shorten link via https://bit.ly Api
import asyncio
import logging
from typing import Dict, Optional
from aiohttp import ClientSession
logger = logging.getLogger('bitly_app')
@yozx
yozx / etl.py
Last active September 10, 2020 12:09
ETL
from typing import Dict, Any, Optional
def extract(raw_data: Dict[Any, Any]) -> Dict[Any, Any]:
if not isinstance(raw_data, dict):
raise TypeError("Failed to load data: Data type must be dict")
return raw_data
@yozx
yozx / WireGuard_Setup.txt
Created June 19, 2022 11:24 — forked from chrisswanda/WireGuard_Setup.txt
Stupid simple setting up WireGuard - Server and multiple peers
Install WireGuard via whatever package manager you use. For me, I use apt.
$ sudo add-apt-repository ppa:wireguard/wireguard
$ sudo apt-get update
$ sudo apt-get install wireguard
MacOS
$ brew install wireguard-tools
Generate key your key pairs. The key pairs are just that, key pairs. They can be