scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

commit 9a382febd9fb8998a580ac01ea2e52271170f073
parent 360f9b5e7d4c0794faf3d30848e362d07283cd76
Author: gearsix <gearsix@tuta.io>
Date:   Thu,  9 Jun 2022 11:59:08 +0100

renamed pyserve to .sh (it's a shell file); added h2d.py

Diffstat:
MREADME.md | 14+++++++++++---
Ad2h.py | 12++++++++++++
Rnix/pyserve.py -> nix/pyserve.sh | 0
3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/README.md b/README.md @@ -19,7 +19,7 @@ I use most of these scripts for convenience and to save on typing. More recently I've been making an effort to learn PowerShell as I tend to use windows a fair bit too, so there are a few one-off scripts used for that too. -## installing +## installing (unix only) I've created an install script (bash) to help with selecting the scripts you want to install. @@ -51,9 +51,16 @@ I've added `-h` options to all the scripts. Personally find `grepf` and `while-true` to by the most frequently used. -## scripts +## windows (powershell) scripts -**strings** +- **random** - a script I use to select a random item in a directory. +- **zip27z** - converts all .zip files in current directory to .7z + +## unix (shell) scripts + +Some are bash-only, I make an effort to keep to **sh** when I can though - for compatibility across unix(-like)s. + +**strings & numbers** Scripts related to string parsing/manipulation @@ -61,6 +68,7 @@ Scripts related to string parsing/manipulation - *grepf* - find all files in dir $1, that conatin string $2. Useful for debugging somebody else's code in a terminal. - *randstr* - generate a random string +- *d2h* - convert decimal numbers to hexadecimal **file management** diff --git a/d2h.py b/d2h.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +# decimal to hex +# description: convert decimal numbers to hexadecimal + +while (True): + d = input('> ') + if d.isdigit(): + print(hex(int(d))) + elif d == 'q' or d == 'quit or ' d == 'exit': + exit() + else: + print(d, 'is not a number') diff --git a/nix/pyserve.py b/nix/pyserve.sh