Skip to content

Instantly share code, notes, and snippets.

@koroshiya
koroshiya / yubi-totp-auth.sh
Last active February 21, 2020 22:35
Script to query yubikey for totp auth code and auto-type it
#!/bin/bash
#This script does the following:
#-prompts the user for a credential name
#-queries the default yubikey for a TOTP token with that credential
#-auto-types the token into another window
#The use case for this is to retrieve a TOTP token for a given website or application
@koroshiya
koroshiya / convertToSteamIcons.sh
Last active November 15, 2019 21:22
Converts a PNG file into the ICO, ICNS and ZIP files used for client images when creating a game on Steam
#!/bin/bash
#sudo apt install icnsutils icoutils imagemagick
#Args are:
#-input file
#-output directory
#-max size
#Input file must be a PNG file and should be bigger than maxsize.
@koroshiya
koroshiya / buildDnsCache.py
Created January 19, 2019 22:11
Creates DNS cache in /etc/hosts based on dnsmasq logs
#!/usr/bin/env python3
"""
This script will run on a linux system which uses dnsmasq.
It extracts cached DNS entries from dnsmasq's logs and writes them to
your system's hosts file.
It also looks for CNAME entries and attempts to "dig" them, then writes
the resolved IP addresses to your system's hosts file as well.
@koroshiya
koroshiya / matchRenpyLiveComposite.py
Created May 18, 2018 12:32
Iterate through a renpy character definition file and report any images without matching side images
import re
import glob
for file in glob.glob("*.rpy"):
with open(file) as f:
lookingForSide = False
for line in f:
if lookingForSide:
m = re.search('image side (\w+) (\w+)', line)
if m:
#!/usr/bin/python
"""
To be fixed up and commented at a later date...
This script does the following:
-reads an original rpy script
-reads a translated version of it
-creates a mapping of language to language by comparing the two files
-applies the translation to a directory with files from renpy's translation extractor process
@koroshiya
koroshiya / findUnusedJavascriptFunctions.py
Created July 27, 2017 05:14
Python 3 script to find unused javascript functions within a project
#!/env/python3 -tt
def findJs(walk_dir, r):
functionsToReturn = []
for root, subdirs, files in os.walk(walk_dir):
if len(root) == 1 or root[0] != '.': #ignore hidden folders, like .git
@koroshiya
koroshiya / backup-apps.sh
Last active March 1, 2022 19:12
Shell script to run automatically backup android device apps and settings. No root, works on all recent versions
#!/bin/bash
#This script requires an Android device that has development mode enabled, and
#has given the computer running this script permission to access it via adb.
#
#The device must be attached to the computer in order for the script to run.
#ie. Connect the two via the USB cable, or whatever you use to connect via adb.
#
#Wireless adb should be possible, but is not currently handled.
#If you know how to use adb over wifi, you should know what changes are needed.