Skip to content

Instantly share code, notes, and snippets.

View azdanov's full-sized avatar

Anton Ždanov azdanov

View GitHub Profile
@azdanov
azdanov / install_apple_fonts.sh
Created November 3, 2024 11:47
Shell script to install apple fonts on Linux
#!/bin/bash
# Script to download and install Apple fonts on Ubuntu
# Inspired by the PKGBUILD script for Arch Linux
# Install wget p7zip-full fontconfig before running the script
set -e
# Create temporary directories
TEMP_DIR=$(mktemp -d)
@azdanov
azdanov / rename.py
Created August 17, 2024 16:53
Rename enumerated mp4 and srt files in a directory from a names list
"""Module for renaming MP4 and SRT files based on names read from a text file."""
import os
import re
from pathlib import Path
# Read names from the text file
with Path("names.txt").open("r") as f:
names = [line.strip() for line in f]
@azdanov
azdanov / index.js
Created August 17, 2024 08:24
Node.js sitemap.xml link checker
const axios = require('axios');
const xml2js = require('xml2js');
const { promisify } = require('util');
const parseXml = promisify(xml2js.parseString);
async function checkUrl(url) {
try {
const response = await axios.head(url, { timeout: 5000 });
return { url, status: response.status };
@azdanov
azdanov / change_background.fish
Last active January 14, 2024 11:41
Change background in fish automatically
function change_background --argument mode_setting
# https://arslan.io/2021/02/15/automatic-dark-mode-for-terminal-applications/
# change background to the given mode. If mode is missing,
# we try to deduct it from the system settings.
set -l mode "light" # default value
if test -z $mode_setting
set -l val (defaults read -g AppleInterfaceStyle) >/dev/null
if test $status -eq 0
set mode "dark"
@azdanov
azdanov / script.sh
Last active May 13, 2019 05:08
Use ripgrep, xargs in parallel with google-java-format
rg --files -g "*.java" | xargs -P 8 google-java-format -i -a
@azdanov
azdanov / script.sh
Last active September 11, 2020 05:37
List all composer packages
cat composer.json | jq -r '.require | keys[]'
@azdanov
azdanov / format-java.sh
Last active September 11, 2020 05:42
Format to Google style guide
find . -name "*.java" | xargs google-java-format -i