more cleaning
This commit is contained in:
parent
8e455a7e3f
commit
1aed01279b
24
bin/bak
24
bin/bak
@ -1,24 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
argv0="$0" [ -n "$SUFFIX" ] \
|
||||
|| SUFFIX=".bak"
|
||||
|
||||
shift 1
|
||||
|
||||
while [ -n "$0" ]; do
|
||||
if [ -e "$0$SUFFIX" ] && ! [ -d "$0$SUFFIX" ]; then
|
||||
"$argv0" "$0$SUFFIX" \
|
||||
|| exit $?
|
||||
elif [ -d "$0$SUFFIX" ]; then
|
||||
printf "%s: %s: Cannot bak directories.\n" "$argv0" "$0" 1>&2
|
||||
exit 64 # sysexits(3) EX_USAGE
|
||||
elif ! [ -e "$0" ]; then
|
||||
printf "%s: %s: File does not exit.\n" "$argv0" "$0" 1>&2
|
||||
exit 64
|
||||
fi
|
||||
|
||||
mv "$0" "$0$SUFFIX" \
|
||||
|| exit $?
|
||||
shift 1
|
||||
done
|
39
bin/music
39
bin/music
@ -1,39 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# DistroTube's dm-radio fixed and in POSIX shell
|
||||
|
||||
alias nonzero="test -n"
|
||||
|
||||
nonzero "$MUSIC_PLAYER" || MUSIC_PLAYER=mpv
|
||||
nonzero "$DMENU" || DMENU=dmenu
|
||||
|
||||
# tab delimits name from URL
|
||||
STATIONS="\
|
||||
50s Rewind https://zeno.fm/radio/50s-rewind/
|
||||
60s Rewind https://zeno.fm/radio/60s-rewind/
|
||||
70s Rewind https://zeno.fm/radio/70s-rewind/
|
||||
80s Rewind https://zeno.fm/radio/80s-rewind/
|
||||
90s Rock https://zeno.fm/radio/90s-rock/
|
||||
The 2000s https://zeno.fm/radio/the-2000s/
|
||||
Classical Radio https://zeno.fm/radio/classical-radio/
|
||||
Classical Relaxation https://zeno.fm/radio/radio-christmas-non-stop-classical/
|
||||
Classic Rock https://zeno.fm/radio/classic-rockdnb2sav8qs8uv/
|
||||
Gangsta49 https://zeno.fm/radio/gangsta49/
|
||||
HipHop49 https://zeno.fm/radio/hiphop49/
|
||||
Madhouse Country Radio https://zeno.fm/radio/madhouse-country-radio/
|
||||
PopMusic https://zeno.fm/radio/popmusic74vyurvmug0uv/
|
||||
PopStars https://zeno.fm/radio/popstars/
|
||||
RadioMetal https://zeno.fm/radio/radio-metal/
|
||||
RocknRoll Radio https://zeno.fm/radio/rocknroll-radio994c7517qs8uv/
|
||||
Cancel nop://
|
||||
"
|
||||
|
||||
selection="$(printf "%s\n" "$STATIONS" | grep -F "$(printf "%s\n" "$STATIONS" | cut -f 1 | dmenu) ")"
|
||||
|
||||
if [ "$selection" = "Cancel nop://" ]
|
||||
then exit 0
|
||||
fi
|
||||
|
||||
pkill -f http || printf "%s: mpv not running.\n" "$0" 1>&2
|
||||
printf "%s\n" "$selection" | cut -f 2 | xargs mpv
|
@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
argv0="$0"
|
||||
usage(){
|
||||
printf "Usage: %s (un) [XRandR output]\n" "$argv0" 1>&2
|
||||
exit 64 # sysexits(3) EX_USAGE
|
||||
}
|
||||
if [ -n "$2" ] && [ "$1" = un ]
|
||||
then xrandr --output "$2" --transform none
|
||||
elif [ -n "$1" ]
|
||||
then "$DISPLAYM_CONFIG/xrandr_transform.sh" "$1"
|
||||
else usage
|
||||
fi
|
@ -1,85 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
# googletrans comes with a translate(1) command line application but I don't
|
||||
# like its UI.
|
||||
|
||||
import sys;
|
||||
|
||||
stdin = sys.stdin;
|
||||
stdout = sys.stdout;
|
||||
stderr = sys.stderr;
|
||||
|
||||
_exit = exit;
|
||||
exit = sys.exit;
|
||||
|
||||
def printf(s, *args):
|
||||
return fprintf(stdout, s, *args);
|
||||
|
||||
def fprintf(f, s, *args):
|
||||
printing = s if len(args) == 0 else (s % args);
|
||||
return f.write(printing);
|
||||
|
||||
try:
|
||||
import googletrans;
|
||||
except:
|
||||
printf(
|
||||
"%s: This Python script requires the \"googletrans\" library.\n",
|
||||
sys.argv[0]
|
||||
);
|
||||
|
||||
def usage(name):
|
||||
fprintf(
|
||||
stderr, "Usage: %s [source language] [destination language]\n",
|
||||
name
|
||||
);
|
||||
exit(1);
|
||||
|
||||
def main(argc, argv):
|
||||
accepted_languages = set(list(googletrans.LANGCODES)
|
||||
+ list(googletrans.LANGUAGES) + [ "auto" ]);
|
||||
good = True;
|
||||
isatty = stdout.isatty();
|
||||
translator = googletrans.Translator();
|
||||
|
||||
if argc != 3:
|
||||
usage(argv[0]);
|
||||
|
||||
src = argv[1].lower();
|
||||
dest = argv[2].lower();
|
||||
for arg in [ src, dest ]:
|
||||
if not(arg in accepted_languages):
|
||||
good = False;
|
||||
fprintf(stderr,
|
||||
"%s: %s: Language not recognized.\n",
|
||||
argv[0], arg);
|
||||
if(not(good)):
|
||||
fprintf(stderr, "The following languages and language codes are"
|
||||
+ " recognized:\n");
|
||||
print(googletrans.LANGCODES);
|
||||
exit(1);
|
||||
|
||||
try:
|
||||
text = stdin.read().split('\n')[:-1]
|
||||
except KeyboardInterrupt:
|
||||
fprintf(stderr, "%s: Cancelled (keyboard interrupt).\n", argv[0]);
|
||||
exit(1);
|
||||
for line in text:
|
||||
try:
|
||||
translation = translator.translate(line, src=src, dest=dest);
|
||||
except:
|
||||
fprintf(stderr, "%s: %s ->%s\n\t%s\n",
|
||||
argv[0], line, dest, "Error trying to translate.");
|
||||
if isatty:
|
||||
fprintf(stdout,
|
||||
"%s -> %s\n"
|
||||
+ "\t%s -> %s\n"
|
||||
+ "\tGiven pronunciation: %s\n",
|
||||
translation.origin, translation.text,
|
||||
translation.src, translation.dest,
|
||||
translation.pronunciation
|
||||
);
|
||||
else:
|
||||
fprintf(stdout, "%s\n", translation.text);
|
||||
return 0;
|
||||
|
||||
exit(main(len(sys.argv), sys.argv));
|
55
cstdlib/ctype.c
Normal file
55
cstdlib/ctype.c
Normal file
@ -0,0 +1,55 @@
|
||||
int
|
||||
isblank(int c){
|
||||
return c == '\t'
|
||||
|| c == ' ';
|
||||
}
|
||||
|
||||
int
|
||||
isspace(int c){
|
||||
return isblank(c)
|
||||
|| c == '\n'
|
||||
|| c == '\v'
|
||||
|| c == '\f'
|
||||
|| c == '\r';
|
||||
}
|
||||
|
||||
int
|
||||
isgraph(int c){ return c >= '!' && c <= '~'; }
|
||||
|
||||
int
|
||||
isprint(int c){ return c == ' ' || isgraph(c); }
|
||||
|
||||
int
|
||||
iscntrl(int c){ return !isprint(c); }
|
||||
|
||||
int
|
||||
isdigit(int c){ return c >= '0' && c <= '9'; }
|
||||
|
||||
int
|
||||
islower(int c){ return c >= 'a' && c <= 'z'; }
|
||||
|
||||
int
|
||||
isupper(int c){ return c >= 'A' && c <= 'Z'; }
|
||||
|
||||
int
|
||||
isxdigit(int c){
|
||||
return
|
||||
isdigit(c)
|
||||
|| (c >= 'a' && c <= 'f')
|
||||
|| (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
int
|
||||
isalpha(int c){ return islower(c) || isupper(c); }
|
||||
|
||||
int
|
||||
isalnum(int c){ return isalpha(c) || isdigit(c) };
|
||||
|
||||
int
|
||||
ispunct(int c){ return c != ' ' && !isalnum(c) };
|
||||
|
||||
int
|
||||
tolower(int c){ return c - isupper(c) * ('A' - 'a'); }
|
||||
|
||||
int
|
||||
toupper(int c){ return c + islower(c) * ('A' - 'a'); }
|
17
cstdlib/ctype.h
Normal file
17
cstdlib/ctype.h
Normal file
@ -0,0 +1,17 @@
|
||||
#ifndef _CTYPE_H
|
||||
# define CTYPE_H
|
||||
int isblank(int c);
|
||||
int isspace(int c);
|
||||
int isgraph(int c);
|
||||
int isprint(int c);
|
||||
int iscntrl(int c);
|
||||
int isdigit(int c);
|
||||
int islower(int c);
|
||||
int isupper(int c);
|
||||
int isxdigit(int c);
|
||||
int isalpha(int c);
|
||||
int isalnum(int c);
|
||||
int ispunct(int c);
|
||||
int tolower(int c);
|
||||
int toupper(int c);
|
||||
#endif /* ifndef _CTYPE_H */
|
@ -1,55 +0,0 @@
|
||||
int
|
||||
_isblank(int c){
|
||||
return c == '\t'
|
||||
|| c == ' ';
|
||||
}
|
||||
|
||||
int
|
||||
_isspace(int c){
|
||||
return isblank(c)
|
||||
|| c == '\n'
|
||||
|| c == '\v'
|
||||
|| c == '\f'
|
||||
|| c == '\r';
|
||||
}
|
||||
|
||||
int
|
||||
_isgraph(int c){ return c >= '!' && c <= '~'; }
|
||||
|
||||
int
|
||||
_isprint(int c){ return c == ' ' || isgraph(c); }
|
||||
|
||||
int
|
||||
_iscntrl(int c){ return !isprint(c); }
|
||||
|
||||
int
|
||||
_isdigit(int c){ return c >= '0' && c <= '9'; }
|
||||
|
||||
int
|
||||
_islower(int c){ return c >= 'a' && c <= 'z'; }
|
||||
|
||||
int
|
||||
_isupper(int c){ return c >= 'A' && c <= 'Z'; }
|
||||
|
||||
int
|
||||
_isxdigit(int c){
|
||||
return
|
||||
isdigit(c)
|
||||
|| (c >= 'a' && c <= 'f')
|
||||
|| (c >= 'A' && c <= 'F');
|
||||
}
|
||||
|
||||
int
|
||||
_isalpha(int c){ return islower(c) || isupper(c); }
|
||||
|
||||
int
|
||||
_isalnum(int c){ return isalpha(c) || isdigit(c) };
|
||||
|
||||
int
|
||||
_ispunct(int c){ return c != ' ' && !isalnum(c) };
|
||||
|
||||
int
|
||||
_tolower(int c){ return c - isupper(c) * ('A' - 'a'); }
|
||||
|
||||
int
|
||||
_toupper(int c){ return c + islower(c) * ('A' - 'a'); }
|
@ -1,75 +0,0 @@
|
||||
#ifndef _CTYPEF_H
|
||||
#define _CTYPEF_H
|
||||
#include <ctype.h>
|
||||
|
||||
# ifdef isalnum
|
||||
# undef isalnum
|
||||
# define isalnum _isalnum
|
||||
# endif
|
||||
|
||||
# ifdef isalpha
|
||||
# undef isalpha
|
||||
# define isalpha _isalpha
|
||||
# endif
|
||||
|
||||
# ifdef isblank
|
||||
# undef isblank
|
||||
# define isblank _isblank
|
||||
# endif
|
||||
|
||||
# ifdef iscntrl
|
||||
# undef iscntrl
|
||||
# define iscntrl _iscntrl
|
||||
# endif
|
||||
|
||||
# ifdef isdigit
|
||||
# undef isdigit
|
||||
# define isdigit _isdigit
|
||||
# endif
|
||||
|
||||
# ifdef isxdigit
|
||||
# undef isxdigit
|
||||
# define isxdigit _isxdigit
|
||||
# endif
|
||||
|
||||
# ifdef isgraph
|
||||
# undef isgraph
|
||||
# define isgraph _isgraph
|
||||
|
||||
# ifdef islower
|
||||
# undef islower
|
||||
# define islower _islower
|
||||
# endif
|
||||
|
||||
# ifdef isprint
|
||||
# undef isprint
|
||||
# define isprint _isprint
|
||||
# endif
|
||||
|
||||
# ifdef ispunct
|
||||
# undef ispunct
|
||||
# define ispunct _ispunct
|
||||
# endif
|
||||
|
||||
# ifdef isspace
|
||||
# undef isspace
|
||||
# define isspace _isspace
|
||||
# endif
|
||||
|
||||
# ifdef isupper
|
||||
# undef isupper
|
||||
# define isupper _isupper
|
||||
# endif
|
||||
|
||||
# ifdef tolower
|
||||
# undef tolower
|
||||
# define tolower _tolower
|
||||
# endif
|
||||
|
||||
# ifdef toupper
|
||||
# undef toupper
|
||||
# define toupper _toupper
|
||||
# endif
|
||||
|
||||
#include "ctypef.c"
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user