Skip to content

Instantly share code, notes, and snippets.

@whoizit
whoizit / yt2text
Created July 10, 2021 06:12
get text from youtube video
#!/usr/bin/env python3
from youtube_transcript_api import YouTubeTranscriptApi as ytta
from youtube_transcript_api.formatters import TextFormatter as tf
import sys
yt_id = (
sys.argv[1]
.removeprefix('https://www.youtube.com/watch?v=')
.removeprefix('https://youtu.be/')
)
[tool.poetry]
name = "test-poetry1"
version = "0.1.0"
description = ""
authors = ["whoizit <whoami@systemli.org>"]
[tool.poetry.dependencies]
python = "^3.8"
django = "^3.0.6"
#!/usr/bin/env python3
# http://who.int/gpsc/5may/Guide_to_Local_Production.pdf
from sys import argv, exit
if len(argv) == 1:
print(
'''\
{} bottle_volume want_alcohol% have_alcohol% have_peroxide% have_glycerol%
Example: {} 250 60 99.7 3 86\
@whoizit
whoizit / ss+v2ray+cf-wss+ubuntu.sh
Last active November 22, 2023 04:09
shadowsocks v2ray-plugin cloudflare-wss ubuntu.sh
#!/bin/sh -e
# For Ubuntu 18.04
# How to launch:
# $ curl https://gist.githubusercontent.com/whoizit/5d29de6161270c7eb20c079add6019d2/raw/ss+v2ray+cf-wss+ubuntu.sh
# $ sh ss+v2ray+cf-wss+ubuntu.sh
[ ${EUID:-$(id -u)} -eq 0 ] && {
echo "This script must NOT be run as root"
exit
}
### FDE
man mkinitfs-bootparam
# filename and path is important
dd bs=512 count=4 if=/dev/urandom of=/crypto_keyfile.bin
cryptsetup luksAddKey /dev/sda1 /crypto_keyfile.bin
chmod 0 /crypto_keyfile.bin
cat /etc/mkinitfs/mkinitfs.conf
features="... cryptsetup cryptkey"
#!/usr/bin/env python3
# pip install -U python-dotenv requests
# https://developer.accuweather.com/accuweather-current-conditions-api/apis/get/currentconditions/v1/%7BlocationKey%7D
import os
import operator
import functools
import requests
import dotenv
@whoizit
whoizit / gist:5b37a986204946a95b07fb90343736dc
Last active September 4, 2019 17:17
kiss minimal install
### Partitioning
fdisk /dev/sda
(o) New DOS table
(n) All free space, Linux filesystem
(w) write and exit
mkfs.ext4 /dev/sda1
mount /dev/sda1 /mnt
# getkiss.org not available in Russia, so I make short urls for github links
@whoizit
whoizit / tiling-weather.py
Last active August 14, 2019 15:26
18°(18°) broken clouds, 4m/s, 63%, {}, 756mmHg
#!/usr/bin/env python3
# pip install --user -U python-dotenv pyowm meteocalc
# get API key in https://openweathermap.org
# create file .env
# OWM_API_KEY=1a1a1a1a1a1a1a1a1
# OWM_PLACE='Saint Petersburg,RU'
# https://github.com/theskumar/python-dotenv
# https://github.com/csparpa/pyowm
# https://github.com/malexer/meteocalc
@whoizit
whoizit / encryptedNixos.md
Last active December 7, 2020 06:44 — forked from ladinu/encryptedNixos.md
NixOS install with encrypted /boot /root with single password unlock

Requirements

  1. Encrypt everthing including /boot and /root
  2. Enter password once

Installation media setup

Download unstable NixOS graphical live iso (cause vim on graphical live iso and easier to read this guide in browser) and write to USB stick.

lsblk
umount /dev/sdX1
dd if=path/to/nixos-graphical-unstable-x86_64-linux.iso of=/dev/sdX bs=10M oflag=direct status=progress
#!/usr/bin/env python3.7
# requirements:
# python3.7
# pip3.7 install shell-scripting
# fping
#
# instruction:
# git clone https://github.com/yggdrasil-network/public-peers
# cd public-peers
# path/to/yggdrasil-ping-public-peers <region> | sort -rn