Skip to content

Instantly share code, notes, and snippets.

View eliask's full-sized avatar
🥼

Elias Kunnas eliask

🥼
View GitHub Profile
@eliask
eliask / braiinsApi.ts
Created February 25, 2023 13:31
Braiins pool API responses in Typescript
// https://help.braiins.com/en/support/solutions/articles/77000433512-api-configuration-guide
type HashRateUnit = "Gh/s" | "Th/s" | "Ph/s";
const _sampleStatsResponse: GeneralPoolStatsResponse = {
btc: {
luck_b10: "0.77",
luck_b50: "0.85",
luck_b250: "0.93",
hash_rate_unit: "Gh/s",
@eliask
eliask / mount.sh
Created June 9, 2022 09:43
Mount drive on WSL2 manually
sudo mount -t drvfs 'G:\\' -o 'uid=1000;gid=1000;metadata;symlinkroot=/mnt/,mmap,access=client,msize=262144,trans=virtio,rw,noatime,dirsync,aname=drvfs' /mnt/g
@eliask
eliask / wintoast.py
Created February 17, 2022 17:17
Windows toast notification with Python
import sys
from xml.sax.saxutils import escape
import winrt.windows.ui.notifications as notifications
import winrt.windows.data.xml.dom as dom
from winrt.windows.ui.notifications import ToastNotificationManager, ToastNotification, ToastTemplateType
if not sys.argv[2:]:
print(f'Usage: {sys.argv[0]} <title> <message ...>')
sys.exit(1)
@eliask
eliask / telegram_types.py
Created October 23, 2020 13:55
Telegram Bot API types in Python
from typing import List, Optional, Union
from dataclasses import dataclass
@dataclass
class CallbackGame: pass # Placeholder - zero fields in API doc
InputMessageContent = Union[
'InputTextMessageContent',
'InputLocationMessageContent',
@eliask
eliask / classify.py
Last active April 27, 2020 13:01
Classifying images with Python and HTML (type o/x for ok/bad)
import http.server
import socketserver
import os, sys, re, glob, shutil
from pathlib import *
PORT = int(sys.argv[1])
def get_known():
try:
known_bad = list({x.strip() for x in open('known_bad.txt').read().strip().split('\n')})
import os, glob, sys
import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support.expected_conditions import presence_of_element_located
from selenium.webdriver.support import expected_conditions as EC
@eliask
eliask / fix_stepmania_chart_links.sh
Created October 8, 2019 12:24
Fix Stepmania/ITG chart BGCHANGES videos/images
@eliask
eliask / install_s4tf.sh
Created August 26, 2019 10:02
Swift for Tensorflow Ubuntu 18.04 idempotent install script
#! /usr/bin/env bash
#
# This is an install script to get a working Swift for Tensorflow
# environment with minimal fuss. Assumes Ubuntu 18.04 and bash.
#
# The script is idempotent so it can be safely run multiple times.
#
# The script uses an existing Anaconda/Miniconda installation
# or installs Miniconda to ~/miniconda3 if missing
#
@eliask
eliask / fi_dns_toplevel.txt
Created July 12, 2019 05:11
List of all/most(?) .fi top-level domains as of 2019-06-21 from https://opendata.rapid7.com/sonar.fdns_v2/
This file has been truncated, but you can view the full file.
0000.fi
000.fi
00100.fi
001.fi
003.fi
005.fi
006.fi
007.fi
007services.fi
007travelers.fi
@eliask
eliask / gist:0992e8efe28ae76635a67915cbff8adf
Created April 13, 2019 14:17
Python get ZIP file contents with a callback API for requesting data ranges
# Code follows from ZIP specifications: https://pkware.cachefly.net/webdocs/APPNOTE/APPNOTE-6.3.5.TXT
# Maybe I should have made this with zipfile and some caching BytesIO like interface instead :)
import requests
import struct
from collections import namedtuple
from dataclasses import dataclass
# Python 3.6: pip install dataclasses
'''