sinisterporpoise: (Default)
 This is a simple Pascal program that should generate secure or simple passwords for a variety of sites. At the moment, it just generates the passwords. It does not save them anywhere. I need to figure out how to save the file with something other than a clear text file. That's going to be a bit difficult as I don't know how to write these algorithms.  It might be an interesting thing to try though.

In any case, here's the code. 

program password_generator;
  uses crt;
var
  numchars: integer;
  password: string[25];
  z: integer;
  {-----------------------------------------------------------------------------}
  { The least officient way to assign a random value to a variable ever.        }
  {-----------------------------------------------------------------------------}
  function determine_Upper (var Upcasechar: integer): char;
 
  begin
    case UpcaseChar of
         0: determine_Upper:= 'A';
         1: determine_Upper:= 'B';
         2: determine_Upper:= 'C';
         3: determine_Upper:= 'D';
         4: determine_Upper:= 'E';
         5: determine_Upper:= 'F';
         6: determine_Upper:= 'G';
         7: determine_Upper:= 'H';
         8: determine_Upper:= 'I';
         9: determine_Upper:= 'J';
         10: determine_Upper:= 'K';
         11: determine_Upper:= 'L';
         12: determine_Upper:= 'M';
         13: determine_Upper:= 'N';
         14: determine_Upper:= 'O';
         15: determine_Upper:= 'P';
         16: determine_Upper:= 'Q';
         17: determine_Upper:= 'R';
         18: determine_Upper:= 'S';
         19: determine_Upper:= 'T';
         20: determine_Upper:= 'U';
         21: determine_Upper:= 'V';
         22: determine_Upper:= 'W';
         23: determine_Upper:= 'X';
         24: determine_Upper:= 'Y';
         25: determine_Upper:= 'Z';
    end;
  end;
  {-----------------------------------------------------------------------------}
  { See the previous function's comment section.                                }
  {-----------------------------------------------------------------------------}
  function determine_Lower (var Lowcasechar: integer): char;
 
  begin
    case Lowcasechar of
         0: determine_Lower:= 'a';
         1: determine_Lower:= 'b';
         2: determine_Lower:= 'c';
         3: determine_Lower:= 'd';
         4: determine_Lower:= 'e';
         5: determine_Lower:= 'f';
         6: determine_Lower:= 'g';
         7: determine_Lower:= 'h';
         8: determine_Lower:= 'i';
         9: determine_Lower:= 'j';
         10: determine_Lower:= 'k';
         11: determine_Lower:= 'l';
         12: determine_Lower:= 'm';
         13: determine_Lower:= 'n';
         14: determine_Lower:= 'o';
         15: determine_Lower:= 'p';
         16: determine_Lower:= 'q';
         17: determine_Lower:= 'r';
         18: determine_Lower:= 's';
         19: determine_Lower:= 't';
         20: determine_Lower:= 'u';
         21: determine_Lower:= 'v';
         22: determine_Lower:= 'w';
         23: determine_Lower:= 'x';
         24: determine_Lower:= 'y';
         25: determine_Lower:= 'z';
    end;
  end;
{-----------------------------------------------------------------------------}
{ This adds the special character into the password for more secure passwords.}
{-----------------------------------------------------------------------------}
function generate_special: char;
var
  assignchar: integer;
begin
  assignchar:= random(4)+1;
  case assignchar of
       1: generate_special:= '!';
       2: generate_special:= '#';
       3: generate_special:= '&';
       4: generate_special:= '%';
  end;
end;
 
{-----------------------------------------------------------------------------}
{ This will generate a complex password for the user. It will do this using   }
{ random character generation. It will use a combination of uppercase and     }
{ lower case letters. The program will then copy the characters into a string }
{ The position of the special character is generated randomly as well.        }
{-----------------------------------------------------------------------------}
procedure generate_complex;
   var
     specialcharnum: integer;
     isupcase: integer;
     loopcounter: integer;
     gcconvertchar: char;
     gc_simple_rand_char: integer;
begin
   specialcharnum:= 0;
   isupcase:= 0;
   clrscr;
   gotoxy(1,1);
   writeln('Generating complex password now.');
   specialcharnum:= random(numchars)+1;
   for loopcounter:= 1 to numchars do
       begin
          gc_simple_rand_char:= random(26);
          if (loopcounter <> specialcharnum) then
          begin
               isupcase:= random(2);
               case isupcase of
                    0: gcconvertchar:= determine_Upper(gc_simple_rand_char);
                    1: gcconvertchar:= determine_Lower(gc_simple_rand_char);
               end;
          end
       else
           begin
              gcconvertchar:= generate_special;
              password[loopcounter]:= gcconvertchar;
           end;
       password[loopcounter]:=  gcconvertchar;
   end;
    for loopcounter:= 0 to numchars do
           begin
             write (password[loopcounter]);
           end;
       writeln ('');
       write ('Press enter to continue.');
       readln;
end;
 
{-----------------------------------------------------------------------------}
{ This is a scaled-down version of the generate complex procedure. It only    }
{ needs to generate valid Ascii characters.                                   }
{-----------------------------------------------------------------------------}
procedure generate_simple;
   var
      simple_Rand_char: integer;
      convertchar: char;
      determineCase: integer;
      loopcounter: integer;
begin
   clrscr;
   writeln ('Generating Password now.');
   determineCase:= 0;
   convertchar:= ' ';
 
   for loopcounter:= 0 to numchars do
       begin
         determineCase:= random(2);
         simple_Rand_Char:= random (26);
         case determineCase of
              0: convertchar:= determine_Upper(simple_Rand_char);
              1: convertchar:= determine_Lower(simple_Rand_Char);
         end;
         password[loopcounter]:= convertchar;
       end;
       write ('Your password is: ');
       for loopcounter:= 0 to numchars do
           begin
             write (password[loopcounter]);
           end;
       writeln ('');
       readln;
end;
{------------------------------------------------------------------------------}
{ Ask the user how long they want their newly generated password to be.        }
{------------------------------------------------------------------------------}
procedure get_password_length;
 
var
   lengthset: boolean;
   label tryagain;
begin
   tryagain:
   clrscr;
   lengthset:= false;
   writeln ('How long would you like your password to be?');
   try
     readln (numchars);
   finally
      writeln ('You''re going to have to try again.');
   end;
   if (numchars < 8) or (numchars > 25) then
       begin
         writeln ('That was not a valid number. Press enter to continue.');
         readln;
         goto tryagain;
       end;
end;
{-----------------------------------------------------------------------------}
{ This program lets the user choose whether they want to generate a simple    }
{ password or a complex password.                                             }
{-----------------------------------------------------------------------------}
procedure choose_simple_or_complex;
 
var
   choice: char;
   label redo;
begin
   choice:= 'x';
   redo:
   clrscr;
   gotoxy (1,1);
   write('--------------------------------------------------------------------');
   gotoxy (1,2);
   write  (' Would you like to genarate a (S)imple password or a (C)omplex   ');
   gotoxy (1,3);
   write  (' password?                                                       ');
   gotoxy( 1,4);
   write('-------------------------------------------------------------------');
   choice:= readkey;
   choice:= upcase (choice);
   get_password_length;
   if (choice = 'S') then
       begin
         generate_simple;
       end
   else if (choice = 'C') then
       begin
         generate_complex;
       end
   else
       begin
         gotoxy (1,5);
         write ('I did not understand that. Press any key to continue.');
         choice:= readkey;
         goto redo;
       end;
 
end;
 
{------------------------------------------------------------------------------}
{ All this does is draw a simple intro screen to tell the user what the program}
{ is for.                                                                      }
{------------------------------------------------------------------------------}
 procedure draw_intro_screen;
 var
    throwaway: char;
 begin;
     throwaway:= 'z';
     gotoxy (1,1);
     writeln ('Sinister Software Solutions');
     gotoxy (23,13);
     write ('Simple Password Generator');
     gotoxy (1,23);
     write ('Press any key to continue.');
     throwaway:= readkey;
     choose_simple_or_complex;
 end;
{=============================================================================}
begin
  for z:= 0 to 25 do
      begin
           password[z]:= ' ';
      end;
  randomize;
  clrscr;
  draw_intro_screen;
end.                    

You'll need Lazarus or an older copy of Turbo Pascal to copy and run it. (The Free Pascal IDE also works, since it uses the same compiler Lazarus does.)  There will be a newer version that will save the passwords. This is done in part because I think that Google Chrome's new secure password generation is a good thing, but I don't trust cloud computing services to store information. They are more likely to be targets of a hack than my home computer.
 
sinisterporpoise: (Default)
 You can use crontab -e to run the script that come below this. Just add this line to it:

00  0  *  *   *   /home/<yourhomedir>/Downloads/backup.sh  
# This assumes you have left the file in your Downloads folder instead of moving it to a more appropriate place.
# The hashtag is just  makes a line a comment in Linux/Unix scripts. (Mac OS X is Unix.)


Now, exit out of Crontab. On my Linux systems, Crontab uses nano, but many other Linux/Unix distributions use vi/vim.

Here is the script if you want to copy and paste it and put it itno a more convenient directory:

!/bin/bash
 
 
cat << EOF
-----------------------------------------------------------------------------
 
Sinister Porpoise Computing Backup Script
Test script for creating multiple
backup files.
 
Lara Landis
11/10/2017
Personal Bash Script
 
----------------------------------------------------------------------------
EOF
 
echo "Now creating backup files..."
 
x=1
y=1 
 
if [[ -f "backup.tar.gz" ]]; then
    x=1
    while [ x==1 ]
    do
    if [[ -f "backup${y}.tar.gz" ]]; then
y=$((y+1))
echo  $y
else
tar -czvf --exclude=*.tar.gz "backup${y}.tar.gz" /home
x=0
fi
   done
else
tar -cvzf --exclude=*.tar.gz "backup.tar.gz" /home
fi
 
How does this differ from the previous versions?  As written, it will only back up the home directories. For entire hard drive backups, simply switch it to the /home line to / .  First, it creates multiple incremental backups.  Second, unlike the previous versions, it excludes files that have been compressed into a tarball, as long as they have the .tar.gz extensions.  Is this better than Time Machine for Mac users? No, probably not. However, it is a handy backup for it.

sinisterporpoise: (Default)
 I feel tired right now, but that’s not uncommon after the Hardware/Software Support Class. I’m taking a break right now in the commons area of campus, and taking some time out to write this. Even though there have been some difficulties this semester, I’m actually glad I did get the chance to go back. These classes have allowed me to rediscover my love of computers and possibly change my direction back to what it should have been.

When it comes down to it, I’m not at all sure Server Administration is the right choice for my major. I was thinking that it would be somewhat more portable than computer programming, but I’ve not heard good things about some of the later classes. I will not spend much time worrying about this. There have been a lot of fun things this semester, and I have the opportunity – if I’m lucky – to get the old student loans I’d forgotten discharged. (I’m trying to look on the bright side here. It’s not generally easy for me. Even though I am tired right now, I am in a good mood.)

I’m wondering if my decision to pursue a writing career was the wrong path for me, or if I simply became burn out on it after working for content mills for years. Either way, it doesn’t matter at this point. It’s also not worth dwelling on it. I’ve chosen something that fits within my current physical limitations, and it’s something I find enjoyable and challenging.

I do think that I need to go back over last week, even though it’s probably a bad idea. In some ways, getting the Ehlers-Danlos diagnosis was a great relief. It explains a lot that’s gone on with my body for a long time. Including the few nights where I stayed up crying all night that weren’t caused by my peers. I had blamed those nights on shin splints from soccer. It explains the clumsiness, the problems with my ankles, and some of my mother’s stories. (It also makes me wonder how much worse things might have been if I’d not gone through puberty for the wrong gender, but the Discworld’s Granny Weatherwax would soon set that kind of thinking straight. It doesn’t matter what might have happened because it didn’t happen.) It also explains why I have supernumerary teeth and accessory ossicles or whatever that podiatrist called them.

Right now, I’m trying to sort out good advice from bad advice, and I’ve been handed a list that includes Dr. Collins’s “ideal” diet for EDS. At least from her talks on YouTube, I’ve found out that there isn’t much research for what she recommends. These are just things she’s tried with her patients with good success. (From what I can tell, her advice would be more accurate if the patient figures out what items work for them rather than going on her list all at once. I’m planning on cutting out dairy, increasing salt intake, and I see no harm in eating fewer processed foods. I know from my own experience to avoid MSG, Caffeine, and Aspartame in large quantities.) 

I’m still in limbo as far as my disability claim goes. I know the hearing will not take place this year. There are only two more months left in this year. I do not know if having Ehlers-Danlos Syndrome on my records will help or not. It will be a ‘rare’ disorder if so. I’m also hoping I didn’t upset my rheumatologist by seeking out a second opinion. After awhile, I realized she was just being cautious and trying not to increase my anxiety levels. While it was frustrating, it’s something I cam to appreciate.

sinisterporpoise: (Default)
 I'd given up programming years ago because I didn't like the Rapid Application Development tools that were available at the time. I know I don't have much artistic or graphic design skills, and this is where the apps were heading. This is no longer the case.  For the classes I'm currently taking, I'm running into some problems with computer math. This is not surprising. Math has never been one of my strongest academic areas, and I was always surprised by my ability to maintain a straight C average consistently in High School. However, getting the right answer -- while important to this class, isn't about what the class is about. It's about understanding how to get the right answer. Knowing how to get the right answer will always be more important for IT professionals than finding it. After all, it is finding the answer that IT professionals get paid for.

To get back to the point, I was having a hard time understanding how to convert decimal numbers into hexadecimal numbers. I thought the easiest way to do get the process down was to write a program that did this for me. I thought that since I enjoy using Pascal and I'm familiar with it that I'd download Lazarus, the open-source equivalent of Delphi, and come up with a graphical utility that does this for me.   I began writhing.

If you read either of the above paragraphs, you might be surprised that I did not actually write a program that did what I intended. The now-finished program converts a hexadecimal number into decimal, which is a far simpler task. During this time, I spent a great deal learning aspects of Pascal and Object Pascal that I had forgotten. The process of discovery excited me. Oddly enough, I don't feel this way about writing. My feelings about writing my come from simple burnout; I spent years doing content mill work to survive.  Content mill work doesn't pay well, isn't exciting, and you have to produce a lot of low-quality output to make a living.  There's also trying to please people who aren't always interested in ethically marketing their product.  

So, I think I've found a new hobby for a while. It's much more suited to my actual talents than cross-stitch, crochet, or doing silly things like building things out of PVC pipe.

Now, if I can just find a way to get the extremely spoon-draining classes that are designed to get students technical certificates out of the way. I went to bed around 8:30 last night and slept until 8:30 this morning. I'm still tired, even though my Synthroid kicked in shortl;y after I took it this morning.

sinisterporpoise: (Default)
 

For the past few months or so, I thought getting a new hobby was necessary for some reason. I do not know exactly why I felt this way, although I can come up with plenty of reasons for it. Now, I realize that this is not necessary. My old hobbies still work. My ability to write has not declined, although I need to spend even more time editing than I have in the past. Because editing was not one of my favorite things to do thin the past either, this may take significantly more time than I would like. This does mean that I will have to give up the copy writing for quick cash business model favored by some of the content mills I use. I would mourn this loss, but I've come to the realization hat I hated this type of writing. It does not allow me to use whatever legitimate talent I possess, and some clients ask you to spread dangerous misinformation

Writing is not the only hobby I've engaged in. I still remain passionate about video games, although I I don't have the funds to purchase all of the latest games. I'm actually okay with this, as the most popular games cater to a different graphic. I'm not an 18 to 25 year-old male. Gamergate and the MRAs associated with it disgust me, but I am not going to give up something I love because other people are immature. As the Canadian Rock Band Rush once said, changes aren't permanent but change is.

As for programming, I still need to learn the most popular Java libraries for Android. While I've master the basics of programming in Java, it doesn't really help me in producing apps for this popular OS. I can't claim too much here. I've been slacking. I've also been learning real-world languages, although I'm reaching a point where Duolingo is no longer challenging my knowledge of Spanish.

Of course, I will continue to use Dreamwidth as an online journal and for some free-writing exercises.

And swimming at the Y today, yay!

sinisterporpoise: (Default)
I decided to delve back into this non-programming programming tool and see if I could get it to run. The makers have made some changes since the last time I used it, and getting the apps onto my Android devices proved to be somewhat harder initially. Then I figured out that it was relatively easy, and doesn't even need a USB cable.  This should make the process of debugging somewhat easier. 

Profile

sinisterporpoise: (Default)
sinisterporpoise

April 2019

S M T W T F S
 1234 56
78910111213
14151617181920
21222324252627
282930    

Syndicate

RSS Atom

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jun. 25th, 2025 06:39 pm
Powered by Dreamwidth Studios