Compare commits
5 Commits
6c481d569d
...
d0527ea349
Author | SHA1 | Date | |
---|---|---|---|
d0527ea349 | |||
92d9e891d7 | |||
5f721f745b | |||
6b90e0e1da | |||
3ba22dbaf7 |
127
homepage
127
homepage
@ -525,6 +525,131 @@ pre { /* DRY who? */
|
||||
}
|
||||
|
||||
|
||||
/blah/2024-04-18.html
|
||||
|
||||
First doctor's appointment since 2022 or so, which doesn't seem like a long
|
||||
time in numbers but feels like a world ago. Last time I had a doctor's
|
||||
appointment Usagi covered kitchen for me and I left [...] at noon and walked up
|
||||
Pine Street to the brick and sunshine and sterile interiors to go to the
|
||||
pediatrician, who was a nurse practitioner (is that how you spell that?)
|
||||
filling in for Jonathan who had seen me the previous dozen or so years, which
|
||||
means a lot more when you're 18. This time [...] and [...] are probably in the
|
||||
kitchen and I'm in a college hospital in a city - was - and got my shit checked
|
||||
out by a nurse, college student, and nurse practicioner (is that how you spell
|
||||
that?).
|
||||
|
||||
My friends really want me to see a therapist. So did the nurse practishuhner -
|
||||
[...] kept me honest when filling out the mental health forms and apparently
|
||||
they did not indicate such a hot pink sparkly life as I lead. They were also
|
||||
more concerned about my chronic short- and long-term memory loss than I am, and
|
||||
recommended Aquaphor for the thing happening on my foot. I got prescribed
|
||||
patches for estrogen because I want my tits to get even bigger (they are pretty
|
||||
big right now, and would be described so even on a cis woman) and because I
|
||||
forget the sublingual tablets fairly often. I also feel worried about brushing
|
||||
my teeth after holding them under my tongue and never remember to do so before-
|
||||
hand. I've never been that great at remembering to brush my teeth.
|
||||
|
||||
I was blah-bbing around when I had my last doctor's appointment. Goodness.
|
||||
|
||||
Before today the last time I had any pizza was February 2023 I think, and I
|
||||
think I had Domino's with [...] and [...] in [...]'s room. When I look back it
|
||||
all seems so flat, like it happened so fast. But at the time I was amazed at
|
||||
how slowly time moved. Now time races by me.
|
||||
|
||||
I saw Good Will Hunting today. Cool to hear Elliot Smith (is that who that
|
||||
was?) in the flick. It made me miss Maine less. The South Boston slums look a
|
||||
lot like Lewiston. Today a lot of the Coloradan doctors were surprised I came
|
||||
from Maine. I have a Mehnn accint, jus'sligh'ly, baht it prahbahbly sahnds like
|
||||
a New Englund accent to the untrained ear. Got a ton of labs done. Estrogen,
|
||||
testosterone, blood sugar, other shit I forgot to read. They laid me down so I
|
||||
didn't pass out like that other time where I came to thinking I was in Five
|
||||
Nights at Freddy's. I accidentally fasted for it because I was on a low-carb
|
||||
diet and didn't know what to eat and so had nothing to eat - I quit, today, at
|
||||
Marco's when we got two large pizzas and three free fountain drinks and I drank
|
||||
a Dr. Pepper, a Mug root beer, and a half-and-half of both just to see what it
|
||||
would taste like.
|
||||
|
||||
The nurse practishinner really wanted me to take a psyche eval. I said I was
|
||||
probably fine and probably wasn't depressed or anxious. [...] gave them a funny
|
||||
look while I said it.
|
||||
|
||||
Last night I said some things to my friends that felt mean, and I wish I
|
||||
didn't. They said it seemed pretty normal to them which is what feels
|
||||
especially bad. For the first time in a good while I don't have any particular
|
||||
urge to get high.
|
||||
|
||||
My blood pressure was good, weight is 192lbs, height is 72.5in with sandals on.
|
||||
My Maine state ID issued 2022-09-19 said my weight was 215lbs so that's 20lbs
|
||||
in 1.5 years. Maybe in five years I'll feel comfortable going to the beach. The
|
||||
only time I've ever felt comfortable in the water is when [...] and I went
|
||||
skinny dipping at night in Winthrop.
|
||||
|
||||
Boston is to New England what Colorado Springs is to Colorado. But Denver has
|
||||
more notable adjacent towns like Aurora; Boston has Worcester (with the world's
|
||||
shittiest Burger King) and Reading (with the world's biggest pricks). I'm not
|
||||
sure what Colorado Springs has near it.
|
||||
|
||||
I wonder if I have any STDs or STIs or diabetes or anything. I'm scared
|
||||
shitless of HIV or diabetes. I was roommates with a guy with HIV and he was
|
||||
cool and took his precautions and had no problem talking about what it was like
|
||||
with me, though society is unkind to those who are HIV+ and he wouldn't talk
|
||||
about it with just anyone. And plenty of people have diabetes and ration
|
||||
insulin and die so I guess I have that to look forward to if that happens. But
|
||||
these lifelong illnesses aren't death sentences anymore, especially for people
|
||||
with Medicaid, so I'll be alright either way hopefully. Diana was right - give
|
||||
your HIV+ friend a hug.
|
||||
|
||||
Can you believe I can write all this shit and can't get myself to work on the
|
||||
book I'm writing?
|
||||
|
||||
|
||||
/blah/2024-04-17.html
|
||||
|
||||
Trip is cancelled. [...] vetoed it for the following reasons:
|
||||
- LSD conflicts with packages already installed in my system and may result in
|
||||
instability.
|
||||
- I have a history of moderate drug abuse; it is hard for me to cope with
|
||||
things without some substance and I spend little of my time sober.
|
||||
|
||||
I keep thinking about [...]. It's terrifying how many people would be hurt if I
|
||||
died. I don't want to end my life in bad kharma.
|
||||
|
||||
I disagree with the notion that kharma is retributive; that it seeks to punish
|
||||
those that deserve it. Kharma is an observation, a description. Kharma is the
|
||||
realization that intentionally malicious action causes harm both to others and
|
||||
one's self, an almost Newtonian law for that impossible-to-analyze humanity.
|
||||
|
||||
One time when I was 16 or 17 my parents noticed I had a pimple on my arm and
|
||||
boxed me into the bathroom and popped it. I broke down sobbing at the
|
||||
realization that, though they had had almost no positive contribution to my
|
||||
life and I barely even knew them as people, having been raised mostly by my
|
||||
grandparents and 4chan/b/, I still hadn't earned my bodily autonomy from them,
|
||||
and truly there was nothing I could do to get away from them without attracting
|
||||
the police or whoever else they would call to come looking for me until I
|
||||
turned 18. I was almost like their housecat, more a housecat than a kid. The
|
||||
conditions of the household deteriorated over the course of my childhood. Their
|
||||
cat, Gator, stopped eating and apparently went into shock after my parents kept
|
||||
yelling at him and spritzing him with a water bottle. He was their stand-in
|
||||
after I went numb to their yelling at me. I sort of envy people whose parents
|
||||
were nice to them, though I don't spread the bad kharma. When I'm high and
|
||||
people tell me about how their parents did something loving for them sometimes
|
||||
I just break the fuck down.
|
||||
|
||||
In the (literal) closet with the morning sun starting to trickle in after
|
||||
another night of sleeplessness when we were 15 or 16 Usagi and I messaged over
|
||||
Instagram. I don't have the stubs anymore so here's a recollection.
|
||||
[U]: Have you ever noticed people with adverse experiences are the most likely
|
||||
to turn out LGBT+?
|
||||
[3]: Yeah but I've never really thought about why.
|
||||
[U]: There's the neocon view that getting your shit fucked up causes your brain
|
||||
to be fucked up. But I think it's just because it's harder to lie to
|
||||
yourself when you're in a really bad place. You have to be honest with
|
||||
yourself or you won't make it out of there.
|
||||
|
||||
I came out to them as trans either a little bit before or a little bit after
|
||||
that.
|
||||
|
||||
|
||||
/blah/2024-04-15.html
|
||||
|
||||
Cyberpunk diet is low carb and high protein. I pray to Snoop Dogg that I may be
|
||||
@ -10729,6 +10854,8 @@ WIDTH="88px"
|
||||
|
||||
|
||||
/blah/Prefix verbatim
|
||||
< <
|
||||
> &rt;
|
||||
|
||||
<!DOCTYPE html>
|
||||
<HEAD>
|
||||
|
100
peek/peek.1
100
peek/peek.1
@ -12,68 +12,96 @@ peek
|
||||
.RB [ program
|
||||
.RB [ arguments... ]])
|
||||
|
||||
.SH USAGE
|
||||
.SH DESCRIPTION
|
||||
|
||||
Peek reads input from standard input with terminal echo disabled, which may be
|
||||
useful to prevent secrets being spied upon by adversaries watching a user's
|
||||
screen.
|
||||
.PP
|
||||
The
|
||||
|
||||
.SH OPTIONS
|
||||
|
||||
.B -1
|
||||
option limits input to a single line (stopping when the newline character is
|
||||
input).
|
||||
.PP
|
||||
The
|
||||
.RS
|
||||
Limits input to a single line (stopping when the newline character is read).
|
||||
.RE
|
||||
|
||||
.B -e
|
||||
.RS
|
||||
Configures peek to output to standard error.
|
||||
.RE
|
||||
|
||||
.B -n
|
||||
option prints ("iNcludes") the terminating character in output; this is only
|
||||
useful when combined with the
|
||||
.RS
|
||||
Prints ("iNcludes") the terminating character in outputs. This is nonsensical
|
||||
if not combined with the
|
||||
.B -1
|
||||
option.
|
||||
.PP
|
||||
The
|
||||
.RE
|
||||
|
||||
.B -o
|
||||
and
|
||||
.B -e
|
||||
options configure Peek to output to standard output and/or standard error
|
||||
respectively and the
|
||||
.RS
|
||||
Configures peek to output to standard output.
|
||||
.RE
|
||||
|
||||
.B -p
|
||||
option configures Peek to output to the standard input of an external program,
|
||||
e.g. a password hashing utility.
|
||||
The
|
||||
.B -p
|
||||
option is provided as a convenience and to avoid potential insecure programmer
|
||||
error in scripts.
|
||||
.PP
|
||||
The
|
||||
.RS
|
||||
Configures peek to pipe output to an executed child program, e.g. a password
|
||||
hashing utility. This is provided as a convenience and to avoid potential
|
||||
insecurities resulting from programmer error in scripts.
|
||||
.RE
|
||||
|
||||
.B -t
|
||||
option makes peek exit if not run in a terminal.
|
||||
.RS
|
||||
Makes peek exit if not run within a terminal.
|
||||
.RE
|
||||
|
||||
.SH DIAGNOSTICS
|
||||
|
||||
Peek prints an error message and exits with the appropriate status from
|
||||
sysexits(3) if it encounters an error.
|
||||
sysexits.h(3) if it encounters an unrecoverable error.
|
||||
|
||||
Peek tries to handle the signal SIGINT (^C) to ensure the user's terminal is
|
||||
still usable after premature termination; if the signal can't be handled, it
|
||||
prints an error message and continues. If peek is interrupted, it exits
|
||||
unsuccessfully, without an error message.
|
||||
|
||||
.SH BUGS
|
||||
|
||||
Accepting secrets in shell scripts is not adviseable in any context.
|
||||
.PP
|
||||
The user's environment passed through to the program used with the
|
||||
.B -p
|
||||
option and their PATH environment variable is used to locate the program.
|
||||
|
||||
If used in a safety-critical application it must be ensured that the
|
||||
environment with which peek is used is not compromised. For example, using
|
||||
POSIX env(1) to set a known, safe PATH, and htpasswd(1) from Apache's utilities
|
||||
package to hash the input with bcrypt:
|
||||
.PP
|
||||
.R env -i PATH=/usr/bin peek -1p htpasswd -nBi '' | cut -d : -f 2
|
||||
.PP
|
||||
environment with which peek is used is not compromised.
|
||||
|
||||
On systems that support it, the ioctl(2) command TIOCSTI can be used to insert
|
||||
characters into the standard input going to peek. This doesn't allow snooping
|
||||
but can be used for general mischief.
|
||||
|
||||
.SH EXAMPLES
|
||||
|
||||
This is a command line for POSIX sh(1), using POSIX env(1) to discard the
|
||||
environment except for PATH, and htpassword(1) from Apache's utilities to hash
|
||||
the input with the bcrypt algorithm, printing the resulting hash:
|
||||
|
||||
.RS
|
||||
.R $ env -i PATH="$PATH" peek -1tp htpasswd -nBi _ | cut -d : -f 2
|
||||
.RE
|
||||
|
||||
This is a POSIX sh(1) command line that lets a user blindly write into a text
|
||||
file, only able to see written lines. Some writers have the habit of
|
||||
prematurely revising their work and use tools like this to prevent it:
|
||||
|
||||
.RS
|
||||
.R $ echo Input ^D to quit. && peek -eot >writing.txt
|
||||
.RE
|
||||
|
||||
.SH AUTHOR
|
||||
|
||||
Written by DTB <trinity@trinity.moe>.
|
||||
|
||||
.SH COPYRIGHT
|
||||
|
||||
Public domain.
|
||||
Copyright (c) 2023-2024 DTB. License AGPLv3+: GNU AGPL version 3 or later
|
||||
<https://gnu.org/licenses/gpl.html>.
|
||||
|
||||
.SH SEE ALSO
|
||||
|
||||
|
108
peek/peek.c
108
peek/peek.c
@ -1,7 +1,7 @@
|
||||
#include <errno.h> /* errno */
|
||||
#include <stdio.h> /* fprintf(3), getc(3), putc(3), stderr, stdin, stdout, EOF,
|
||||
* NULL */
|
||||
#include <stdlib.h> /* size_t */
|
||||
#include <signal.h> /* sigaction(2), struct sigaction, SIGINT */
|
||||
#include <stdio.h> /* fprintf(3), getc(3), perror(3), putc(3), stderr, stdin,
|
||||
* stdout, EOF, NULL */
|
||||
#include <stdlib.h> /* exit(3), size_t, EXIT_FAILURE */
|
||||
#include <string.h> /* strerror(3) */
|
||||
#if !defined EX_OK || !defined EX_OSERR || !defined EX_USAGE
|
||||
# include <sysexits.h>
|
||||
@ -10,12 +10,34 @@
|
||||
#include <unistd.h> /* dup(2), execvp(3), fork(2), getopt(3), isatty(3),
|
||||
* pipe(2), STDIN_FILENO */
|
||||
|
||||
static int oserr(char *s){ perror(s); return EX_OSERR; }
|
||||
|
||||
static char *program_name = "peek";
|
||||
|
||||
static int usage(char *s){
|
||||
fprintf(stderr, "Usage: %s (-1enot) (-p [program [arguments...]])\n",
|
||||
s == NULL ? program_name : s);
|
||||
return EX_USAGE;
|
||||
}
|
||||
|
||||
/* Restores terminal echo; otherwise when a user ^Cs the terminal would
|
||||
* continue to not display typed text. If sig isn't zero, this will terminate
|
||||
* the program. */
|
||||
void restore_echo(int sig){
|
||||
static struct termios t;
|
||||
|
||||
tcgetattr(STDIN_FILENO, &t);
|
||||
t.c_lflag |= ECHO;
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &t);
|
||||
|
||||
if(sig != 0)
|
||||
exit(EXIT_FAILURE);
|
||||
else
|
||||
return;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[]){
|
||||
int c;
|
||||
int eof;
|
||||
size_t i;
|
||||
char include_eof;
|
||||
FILE *outputs[] = {
|
||||
NULL /* stdout */,
|
||||
@ -23,13 +45,15 @@ int main(int argc, char *argv[]){
|
||||
NULL /* -p */
|
||||
};
|
||||
int p[2] = {0, 0};
|
||||
struct termios t;
|
||||
|
||||
if(argc < 1)
|
||||
goto usage;
|
||||
usage(argv[0]);
|
||||
|
||||
eof = EOF;
|
||||
include_eof = 0;
|
||||
{ /* options parsing */
|
||||
int c;
|
||||
|
||||
while((c = getopt(argc, argv, "1enopt")) != -1)
|
||||
switch(c){
|
||||
case '1': eof = '\n'; break;
|
||||
@ -37,10 +61,8 @@ int main(int argc, char *argv[]){
|
||||
case 'o': outputs[0] = stdout; break;
|
||||
case 'e': outputs[1] = stderr; break;
|
||||
case 'p':
|
||||
if(pipe(p) != 0)
|
||||
goto die;
|
||||
else if((outputs[2] = fdopen(p[1], "ab")) == NULL)
|
||||
goto die;
|
||||
if(pipe(p) != 0 || (outputs[2] = fdopen(p[1], "ab")) == NULL)
|
||||
return oserr(argv[0]);
|
||||
break;
|
||||
case 't':
|
||||
if(isatty(STDIN_FILENO) != 1){
|
||||
@ -48,56 +70,68 @@ int main(int argc, char *argv[]){
|
||||
" (option -t specified)\n", argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
default: goto usage;
|
||||
default: return usage(argv[0]);
|
||||
}
|
||||
}
|
||||
|
||||
/* If -p is used there must be additional arguments. Getopt(3) wouldn't
|
||||
/* If -p is used there must be additional arguments. getopt(3) wouldn't
|
||||
* work for this because optarg would have to be one string to give to
|
||||
* system(3) or an equivalent and it would be a mess of parsing and
|
||||
* security issues. Any intended usage works with this slightly funkier
|
||||
* argument parsing, unintended usages work as happy coincidence. */
|
||||
if((argc > optind) == (outputs[2] == 0)){
|
||||
usage: fprintf(stderr, "Usage: %s (-1enot)"
|
||||
" (-p [program [arguments...]])\n",
|
||||
argv[0] == NULL ? program_name : argv[0]);
|
||||
return EX_USAGE;
|
||||
}
|
||||
if((argc > optind) == (outputs[2] == 0))
|
||||
return usage(argv[0]);
|
||||
|
||||
if(outputs[2] != 0)
|
||||
switch(fork()){
|
||||
case 0:
|
||||
if(close(p[1]) == 0
|
||||
&& dup2(p[0], STDIN_FILENO)
|
||||
== STDIN_FILENO)
|
||||
execvp(argv[optind], argv + optind);
|
||||
if(close(p[1]) == 0 && dup2(p[0], STDIN_FILENO) == STDIN_FILENO)
|
||||
execvp(argv[optind], &argv[optind]);
|
||||
case -1:
|
||||
goto die;
|
||||
return oserr(argv[0]);
|
||||
default:
|
||||
if(close(p[0]) != 0)
|
||||
goto die;
|
||||
return oserr(argv[0]);
|
||||
}
|
||||
|
||||
/* terminal echo */
|
||||
{ /* install signal handler for ^C to avoid terminal phooeyness */
|
||||
struct sigaction act = { 0 };
|
||||
|
||||
act.sa_handler = restore_echo;
|
||||
/* This error isn't terminating because the worst that happens is some
|
||||
* terminal phooeyness if things go awry. */
|
||||
if(sigaction(SIGINT, &act, NULL) != 0)
|
||||
perror(argv[0]);
|
||||
}
|
||||
|
||||
{ /* banish terminal echo */
|
||||
struct termios t;
|
||||
|
||||
tcgetattr(STDIN_FILENO, &t);
|
||||
t.c_lflag ^= ECHO;
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &t);
|
||||
}
|
||||
|
||||
{ /* actual input loop */
|
||||
int c;
|
||||
size_t i;
|
||||
|
||||
do{ if((c = getc(stdin)) != eof || include_eof)
|
||||
for(i = 0; i < (sizeof outputs)/(sizeof *outputs); ++i)
|
||||
if(outputs[i] != NULL
|
||||
&& putc(c, outputs[i]) == EOF){
|
||||
if(i == 2)
|
||||
if(outputs[i] != NULL && putc(c, outputs[i]) == EOF){
|
||||
if(outputs[i] != stdout && outputs[i] != stderr)
|
||||
fclose(outputs[i]);
|
||||
outputs[i] = 0;
|
||||
outputs[i] = NULL;
|
||||
}
|
||||
}while(c != eof);
|
||||
}
|
||||
|
||||
tcgetattr(STDIN_FILENO, &t);
|
||||
t.c_lflag |= ECHO;
|
||||
tcsetattr(STDIN_FILENO, TCSAFLUSH, &t);
|
||||
restore_echo(0);
|
||||
|
||||
if(outputs[2] /* -p */ != NULL){
|
||||
fclose(outputs[2]);
|
||||
close(p[1]);
|
||||
}
|
||||
|
||||
return EX_OK;
|
||||
|
||||
die: fprintf(stderr, "%s: %s\n", argv[0], strerror(errno));
|
||||
return EX_OSERR;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user