Skip to content

Instantly share code, notes, and snippets.

View YuriyGuts's full-sized avatar

Yuriy Guts YuriyGuts

View GitHub Profile
@YuriyGuts
YuriyGuts / gist-clone-all.py
Last active February 26, 2024 05:32
Clones all GitHub Gists for the specified user.
#!/usr/bin/env python
"""
Clone all GitHub Gists for the specified user.
Copyright (c) 2018 Yuriy Guts
usage: gist-clone-all.py [-h] user token
positional arguments:
user Which user's Gists to clone.
@YuriyGuts
YuriyGuts / linux-mint-install-everything.sh
Last active February 26, 2024 05:31
A script to install most of the necessary software on a fresh Linux Mint installation. Uses Google Drive to import settings for specific applications. Latest revision: Linux Mint 21.1 Vera / Ubuntu 22.04
#!/bin/bash
# =========== CONFIG =============
# Assuming we'll set the Google Drive folder to ~/GoogleDrive
GOOGLE_DRIVE_FOLDER=$HOME/GoogleDrive
# ================================
# =========== ESSENTIAL ALIASES ==========
INSTALL='sudo apt install --yes'
@YuriyGuts
YuriyGuts / github-clone-all.py
Last active January 1, 2024 11:20
Clone all public and private repositories from a specific GitHub user or organization
#!/usr/bin/env python
"""
Clone all public and private repositories from a GitHub user or organization.
Copyright (c) 2018 Yuriy Guts
usage: github-clone-all.py [-h] [--auth-user AUTH_USER]
[--auth-password AUTH_PASSWORD] [--clone-user USER]
[--clone-org ORG]
@YuriyGuts
YuriyGuts / chocolatey-install-apps.cmd
Last active September 27, 2023 21:22
A script to install all necessary software on a fresh Windows installation using Chocolatey
@echo off
rem ===== Run this first: =====
rem @powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin
rem choco feature enable -n=allowGlobalConfirmation
rem mkdir C:\Tools
rem choco install -y toolsroot
rem ===========================
rem ----- Essentials -----
@YuriyGuts
YuriyGuts / russian_casualty_parser.py
Last active September 22, 2023 14:04
Parse the numbers of Russian casualties in Ukraine from a news website, save them to CSV files, and plot them
# -*- coding: utf-8 -*-
# Parse the numbers of Russian casualties in Ukraine from a news website, save them to CSV files, and plot them.
#
# Prerequisites:
# $ pip install beautifulsoup4==4.10.0 matplotlib==3.4.3 requests==2.26.0 pandas==1.3.4
#
# Usage:
# $ python3 russian_casualty_parser.py
#
# Output:
@YuriyGuts
YuriyGuts / dashcam-encode.py
Last active April 14, 2023 12:13
Merge and encode dashcam videos stored on an SD card
#!/usr/bin/env python3
"""
Concatenate and encode dashcam videos stored on an SD card.
Assumes the videos are stored as *xxxx.avi / *xxxx.mp4 / *xxxx.mov, where xxxx is a
sequential index. This should be compatible with most dashcam SoC manufacturers.
System requirements and dependencies:
-------------------------------------
@YuriyGuts
YuriyGuts / blackout-daily-stats.py
Last active February 2, 2023 10:38
Given a dataset of blackout events, generate daily downtime stats and calendar visualizations
#!/usr/bin/env python3
"""
Given a dataset of blackout events, generate daily downtime stats and calendar visualizations.
-------------------
Prerequisites
-------------------
python3 -m venv ~/.virtualenvs/blackout-stats
source ~/.virtualenvs/blackout-stats/bin/activate
pip install pandas==1.5.2 matplotlib==3.6.2 july==0.1.3
@YuriyGuts
YuriyGuts / window_arrange.py
Created October 11, 2017 19:20
Save or restore X11 desktop window arrangement using the wmctrl package
#!/usr/bin/env python3
"""
Save or restore X11 desktop window arrangement.
Requires the `wmctrl` package to work.
Examples:
window_arrange.py save
window_arrange.py restore
window_arrange.py --profile ~/.winlayout-home save
@YuriyGuts
YuriyGuts / install-persistent-touch-id-sudo.sh
Last active February 2, 2022 13:04
Installs a PAM configuration script as a macOS launch daemon so that Touch ID for sudo is always available and persists across OS updates
#!/usr/bin/env bash
# This script installs a PAM configuration script as a macOS launch daemon
# so that Touch ID for sudo is always available and persists across OS updates.
# NOTE: You might need to allow /usr/bin/env in Security & Privacy > Full Disk Access.
set -euo pipefail
PACKAGE_NAME="com.yuriyguts.persistent-touch-id-sudo"
CONFIG_SCRIPT_INSTALL_PATH="/usr/local/bin/${PACKAGE_NAME}.sh"
@YuriyGuts
YuriyGuts / kindle-cloud-reader-custom-sepia.js
Last active October 31, 2020 18:28
A bookmarklet for applying a custom style to Kindle Cloud Reader (applies a sepia theme with a higher contrast similar to iBooks on iPad; increases the size of fonts that are too small). Use a tool like http://ted.mielczarek.org/code/mozilla/bookmarklet.html to convert it to a one-liner and use it as a bookmarklet.
function applyCustomStyle() {
var config = {
backgroundColor: "rgb(246, 239, 220)",
foregroundColor: "rgb(64, 41, 25)",
highlightColor: "rgb(255, 245, 173)",
codeFontSize: "12px"
};
var masterFrameContents = $("#KindleReaderIFrame").contents();
var pageFrameContents = masterFrameContents.find("iframe").contents();