Moves binaries for use with gnu stow
This commit is contained in:
parent
f528ba793c
commit
4fd9f4809b
89 changed files with 0 additions and 0 deletions
22
bin/.bin/conversion/code-to-pdf
Executable file
22
bin/.bin/conversion/code-to-pdf
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
TITLE="$1"
|
||||
shift
|
||||
|
||||
enscript -1 --media=A4 \
|
||||
--toc \
|
||||
--header '%H - $N | | page $% of $= in file $v' \
|
||||
--font "Menlo-Regular@8.5" \
|
||||
--header-font "Menlo-Bold@10" \
|
||||
--margins=60:60:18:60 \
|
||||
--fancy-header=sjl \
|
||||
--title $TITLE \
|
||||
--baselineskip 3 \
|
||||
--line-numbers \
|
||||
--highlight \
|
||||
--color \
|
||||
--mark-wrapped-lines=arrow \
|
||||
-p - \
|
||||
--word-wrap $* \
|
||||
| ps2pdf -i -o code.pdf
|
||||
|
12
bin/.bin/conversion/convert-to-pdf
Executable file
12
bin/.bin/conversion/convert-to-pdf
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
file=$(readlink -f "$1")
|
||||
dir=$(dirname "$file")
|
||||
base="${file%.*}"
|
||||
|
||||
cd "$dir" || exit
|
||||
|
||||
case "$file" in
|
||||
*\.doc|*\.docx) libreoffice --convert-to pdf "$file" ;;
|
||||
*) echo "Don't know how to convert $file"
|
||||
esac
|
157
bin/.bin/conversion/csvtomd
Executable file
157
bin/.bin/conversion/csvtomd
Executable file
|
@ -0,0 +1,157 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
"""
|
||||
csvtomd 0.2.1
|
||||
|
||||
Convert your CSV files into Markdown tables.
|
||||
|
||||
More info: http://github.com/mplewis/csvtomd
|
||||
"""
|
||||
|
||||
import argparse
|
||||
import csv
|
||||
import sys
|
||||
|
||||
|
||||
def check_negative(value):
|
||||
try:
|
||||
ivalue = int(value)
|
||||
except ValueError:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'"%s" must be an integer' % value)
|
||||
if ivalue < 0:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'"%s" must not be a negative value' % value)
|
||||
return ivalue
|
||||
|
||||
|
||||
def pad_to(unpadded, target_len):
|
||||
"""
|
||||
Pad a string to the target length in characters, or return the original
|
||||
string if it's longer than the target length.
|
||||
"""
|
||||
under = target_len - len(unpadded)
|
||||
if under <= 0:
|
||||
return unpadded
|
||||
return unpadded + (' ' * under)
|
||||
|
||||
|
||||
def normalize_cols(table):
|
||||
"""
|
||||
Pad short rows to the length of the longest row to help render "jagged"
|
||||
CSV files
|
||||
"""
|
||||
longest_row_len = max([len(row) for row in table])
|
||||
for row in table:
|
||||
while len(row) < longest_row_len:
|
||||
row.append('')
|
||||
return table
|
||||
|
||||
|
||||
def pad_cells(table):
|
||||
"""Pad each cell to the size of the largest cell in its column."""
|
||||
col_sizes = [max(map(len, col)) for col in zip(*table)]
|
||||
for row in table:
|
||||
for cell_num, cell in enumerate(row):
|
||||
row[cell_num] = pad_to(cell, col_sizes[cell_num])
|
||||
return table
|
||||
|
||||
|
||||
def horiz_div(col_widths, horiz, vert, padding):
|
||||
"""
|
||||
Create the column dividers for a table with given column widths.
|
||||
|
||||
col_widths: list of column widths
|
||||
horiz: the character to use for a horizontal divider
|
||||
vert: the character to use for a vertical divider
|
||||
padding: amount of padding to add to each side of a column
|
||||
"""
|
||||
horizs = [horiz * w for w in col_widths]
|
||||
div = ''.join([padding * horiz, vert, padding * horiz])
|
||||
return div.join(horizs)
|
||||
|
||||
|
||||
def add_dividers(row, divider, padding):
|
||||
"""Add dividers and padding to a row of cells and return a string."""
|
||||
div = ''.join([padding * ' ', divider, padding * ' '])
|
||||
return div.join(row)
|
||||
|
||||
|
||||
def md_table(table, *, padding=1, divider='|', header_div='-'):
|
||||
"""
|
||||
Convert a 2D array of items into a Markdown table.
|
||||
|
||||
padding: the number of padding spaces on either side of each divider
|
||||
divider: the vertical divider to place between columns
|
||||
header_div: the horizontal divider to place between the header row and
|
||||
body cells
|
||||
"""
|
||||
table = normalize_cols(table)
|
||||
table = pad_cells(table)
|
||||
header = table[0]
|
||||
body = table[1:]
|
||||
|
||||
col_widths = [len(cell) for cell in header]
|
||||
horiz = horiz_div(col_widths, header_div, divider, padding)
|
||||
|
||||
header = add_dividers(header, divider, padding)
|
||||
body = [add_dividers(row, divider, padding) for row in body]
|
||||
|
||||
table = [header, horiz]
|
||||
table.extend(body)
|
||||
table = [row.rstrip() for row in table]
|
||||
return '\n'.join(table)
|
||||
|
||||
|
||||
def csv_to_table(file, delimiter):
|
||||
return list(csv.reader(file, delimiter=delimiter))
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description='Read one or more CSV files and output their contents in '
|
||||
'the form of Markdown tables.')
|
||||
parser.add_argument('files', metavar='csv_file', type=str, nargs='*',
|
||||
default=['-'],
|
||||
help="One or more CSV files to be converted. "
|
||||
"Use - for stdin.")
|
||||
parser.add_argument('-n', '--no-filenames', action='store_false',
|
||||
dest='show_filenames',
|
||||
help="Don't display filenames when outputting "
|
||||
"multiple Markdown tables.")
|
||||
parser.add_argument('-p', '--padding', type=check_negative, default=2,
|
||||
help="The number of spaces to add between table cells "
|
||||
"and column dividers. Default is 2 spaces.")
|
||||
parser.add_argument('-d', '--delimiter', default=',',
|
||||
help='The delimiter to use when parsing CSV data. '
|
||||
'Default is "%(default)s"')
|
||||
|
||||
args = parser.parse_args()
|
||||
first = True
|
||||
|
||||
if '-' in args.files and len(args.files) > 1:
|
||||
print('Standard input can only be used alone.', file=sys.stderr)
|
||||
exit(1)
|
||||
for file_num, filename in enumerate(args.files):
|
||||
# Print space between consecutive tables
|
||||
if not first:
|
||||
print('')
|
||||
else:
|
||||
first = False
|
||||
# Read the CSV files
|
||||
if filename == '-':
|
||||
table = csv_to_table(sys.stdin, args.delimiter)
|
||||
else:
|
||||
with open(filename, 'rU') as f:
|
||||
table = csv_to_table(f, args.delimiter)
|
||||
# Print filename for each table if --no-filenames wasn't passed and
|
||||
# more than one CSV was provided
|
||||
file_count = len(args.files)
|
||||
if args.show_filenames and file_count > 1:
|
||||
print(filename + '\n')
|
||||
# Generate and print Markdown table
|
||||
print(md_table(table, padding=args.padding))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
45
bin/.bin/conversion/iso-to-game-cube
Executable file
45
bin/.bin/conversion/iso-to-game-cube
Executable file
|
@ -0,0 +1,45 @@
|
|||
#!/usr/bin/sh
|
||||
if [ $# -lt 1 ]; then
|
||||
echo -e "convert gamecube iso games to ciso (compress iso, ignore usused blocks)."
|
||||
echo -e "works with nintendont v4.428+ and usbloadergx on a modded wii console."
|
||||
echo -e "Note: after conversion the ciso will be renamed to iso to make it work under usbloadergx"
|
||||
echo -e "\nUsage: $0 <filename>"
|
||||
echo -e "\nExample:\n$0 Melee.iso"
|
||||
echo -e "$0 Melee.iso DoubleDash.iso WindWaker.iso"
|
||||
echo -e "$0 *.iso"
|
||||
echo -e "\nNintendont uses these paths:"
|
||||
echo -e "USB:/games/"
|
||||
echo -e "USB:/games/Name of game [GameID]/game.iso"
|
||||
echo -e "USB:/games/Legend of Zelda the Wind Waker (USA) [GZLP01]/game.iso"
|
||||
echo -e "\nMultiple Gamecube Disc Example:"
|
||||
echo -e "USB:/games/Resident Evil 4 (USA) [G4BE08]/game.iso"
|
||||
echo -e "USB:/games/Resident Evil 4 (USA) [G4BE08]/disc2.iso"
|
||||
return 1
|
||||
fi
|
||||
myArray=( "$@" )
|
||||
for arg in "${myArray[@]}"; do
|
||||
FILENAME="${arg%.*}"
|
||||
REGION=$(wit lll -H "$arg" | awk '{print $4}')
|
||||
GAMEID=$(wit lll -H "$arg" | awk '{print $1}')
|
||||
TITLE=$(wit lll -H "$arg" | awk '{ print substr($0, index($0,$5)) }' | awk '{$1=$1};1' )
|
||||
DIR_FILENAME="$FILENAME [$GAMEID]"
|
||||
DIR_TITLENAME="$TITLE [$GAMEID]"
|
||||
|
||||
## no conversion; only generate folder base on title inside the rom, move iso to folder
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# mv -v "$arg" "$DIR_TITLENAME"/game.iso
|
||||
|
||||
## no conversion; only generate folder base on filename, move iso to folder
|
||||
# mkdir -pv "$DIR_FILENAME"
|
||||
# mv -v "$arg" "$DIR_FILENAME"/game.iso
|
||||
|
||||
## convert to ciso; generate folder base on title inside the rom; move ciso to folder
|
||||
## rename ciso to iso ; this will make it compatible with both nintendont and usbloadergx
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# wit copy --ciso "$arg" "$DIR_TITLENAME"/game.iso
|
||||
|
||||
## convert to ciso; generate folder base on filename; move ciso to folder
|
||||
## rename ciso to iso ; this will make it compatible with both nintendont and usbloadergx
|
||||
mkdir -pv "$DIR_FILENAME"
|
||||
wit copy --ciso "$arg" "$DIR_FILENAME"/game.iso
|
||||
done
|
35
bin/.bin/conversion/iso-to-wii
Executable file
35
bin/.bin/conversion/iso-to-wii
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/sh
|
||||
if [ $# -lt 1 ]; then
|
||||
echo -e "convert wii iso games to wbfs that will works with usbloadergx on a modded wii console"
|
||||
echo -e "\nUsage: $0 <filename>"
|
||||
echo -e "\nExample:\n$0 WiiSports.iso"
|
||||
echo -e "$0 MarioKart.iso Zelda.iso DonkeyKong.iso"
|
||||
echo -e "$0 *.iso"
|
||||
echo -e "\nUSBLoaderGX uses these paths:"
|
||||
echo -e "USB:/wbfs/"
|
||||
echo -e "USB:/wbfs/Name of game [GameID]/GameID.wbfs"
|
||||
echo -e "USB:/wbfs/Donkey Kong Country Returns (USA) [SF8E01]/SF8E01.wbfs"
|
||||
echo -e "\nSplit Wii Game Example:"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf1"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf2"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbf3"
|
||||
echo -e "USB:/wbfs/Super Smash Bros Brawl (NTSC) [RSBE01]/RSBE01.wbfs"
|
||||
return 1
|
||||
fi
|
||||
myArray=( "$@" )
|
||||
for arg in "${myArray[@]}"; do
|
||||
FILENAME="${arg%.*}"
|
||||
REGION=$(wit lll -H "$arg" | awk '{print $4}')
|
||||
GAMEID=$(wit lll -H "$arg" | awk '{print $1}')
|
||||
TITLE=$(wit lll -H "$arg" | awk '{ print substr($0, index($0,$5)) }' | awk '{$1=$1};1' )
|
||||
DIR_FILENAME="$FILENAME [$GAMEID]"
|
||||
DIR_TITLENAME="$TITLE [$GAMEID]"
|
||||
|
||||
## create proper folder structure base on title inside the rom, scrub image & convert to wbfs, auto split at 4GB a piece
|
||||
# mkdir -pv "$DIR_TITLENAME"
|
||||
# wit copy --wbfs --split "$arg" "$DIR_TITLENAME"/"$GAMEID.wbfs"
|
||||
|
||||
## create proper folder structure base on filename, scrub image & convert to wbfs, auto split at 4GB a piece
|
||||
mkdir -pv "$DIR_FILENAME"
|
||||
wit copy --wbfs --split "$arg" "$DIR_FILENAME"/"$GAMEID.wbfs"
|
||||
done
|
14
bin/.bin/conversion/otf2ttf
Executable file
14
bin/.bin/conversion/otf2ttf
Executable file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env python
|
||||
import fontforge as ff
|
||||
import sys
|
||||
|
||||
args = sys.argv[1:]
|
||||
|
||||
if args[0] == '--help':
|
||||
print("otf2ttf <font>")
|
||||
else:
|
||||
otf = args[0]
|
||||
ttf = otf.replace('otf','ttf')
|
||||
print( otf + ' => ' + ttf )
|
||||
f = ff.open( otf )
|
||||
f.generate( ttf )
|
Loading…
Add table
Add a link
Reference in a new issue