Bashing izzaboo with a Blog

tilde.club/~izzaboo via BashBlog

Success With SSH

January 14, 2015 — Greg Haas

We've been seeing some success with using our brains and bodies to get ssh key-pairs working the way we like them. So, ha!

Pretty happy about that!

Also rocking the screen and tmux worlds. Using mosh and other apps on chromebook to ssh into another server then ssh out from there to tilde.club and others. By keeping things there, I can keep it almost as messy as my real desktop, even when I'm loggin in remotely I can wallow in my mess!

And I'm still beating my brain up with Javascript. I wrote a big ol' function that had four if...else and now I'm trying to rewrite with each being their own function that are called by various actions. Before, I called the same function with different parameters but ended up with lots of repeated code.

Wishing myself luck.

Tags: javascript, screen, tmux, learning, ssh, keypairs

Comments? Tweet  

Distracted, But Not Totally

November 26, 2014 — Greg Haas

I got a little distracted from awk, sed and bash scripting. I fell back into learning more Javascript but did so in a way that helped me understand regex. Yay!

I made this little ditty: Random Paragraphs from Alice's Adventures in Wonderland

But for reading with your family you may want the ordered version: Alice's Adventures in Wonderland.

Tags: files, regex, learn

Comments? Tweet  

awk, sed, etc.

November 23, 2014 — Greg Haas

The next bit in this project is to learn to understand what's going on with awk, sed and regex.

Back down I go.

Tags: files, policy, learn, bash

Comments? Tweet  

Parsing Once, Parsing Twice...

November 20, 2014 — Greg Haas

As I said before, I still have a lot to learn!

I'm learning more about bash scripting, as I'd hoped! I've been working with a javasript/PHP combo that reads flat text files and generates html dynamically. I'm thinking something like bashblog could be used to read from an uploaded text file or of the temporary text output from $EDITOR. I'm imagining feeding the command "convert" instead of "post". So one would enter:

shell$: ./bb.sh convert -html /home/user/www/files/file1.txt.

Or would it bet better to add an argument to edit or post command? Such as

shell$: post -t -html ~/www/files/*.txt
?

I don't know if it is any good, but I've been working with custom markup, since all the files are of very simple and consistent format: Right aligned file code, centered file title in H3, paragraphs, two-level lists, sub-headings, left aligned in H4 and some bold characters.

for (var i = 0; i < numLines; i++){
  if (lines[i].lastIndexOf('~~>',0) === 0){
    parsedData += "<p  class=\"text-right\">"+lines[i].slice(3)+"</p>";
  }else if(lines[i].lastIndexOf('===', 0) === 0){
    parsedData += "<h4>"+ lines[i].slice(3)+"</h4>";
  }else if(lines[i].lastIndexOf('==',0) === 0){
    parsedData += "<h3>"+ lines[i].slice(2)+"</h3>";
  }else if(lines[i].lastIndexOf('***',0) === 0){
    parsedData += "<b style=\"font-size: .8em;\">"+lines[i].slice(3)+"</b>";
  }else if(lines[i].lastIndexOf('~~~',0) === 0){
    parsedData += "<p class=\"text-justify\">"+ lines[i].slice(3)+"</p>";
  }else if(lines[i].indexOf('    ') === 0){
    parsedData += "<li style=\"margin-left: 2.2em;list-style-type: none;\">"
                +lines[i].slice(4))+"</li>";
  }else if(lines[i].indexOf('  ') === 0){
    parsedData += "<li style=\"margin-left: 1.2em;list-style-type: none;\">"
                +lines[i].slice(2)+"</li>";
  }else{
    parsedData += "<p>"+ lines[i]+"</p>";
  }
}
return parsedData;

That's a lotta if-else pudding. But, good JS or not, that ought to be fairly easy to do with bash scripting, right? Easier, maybe?

The other piece is the file opening and reading. Right now I'm doing ajax requests to a php script which is returning the string to be parsed by javascript. I use ajax because there are several series, or groupings of files, then the files themselves. I put each grouping in a directory. One <select> menu chooses the folder, the next menu chooses the .txt file and javascript splats it into innerHTML.

Feels very much like a kludge and although it works, I'd like it to be more elegant. I don't know. I'd also like it searchable on the front end...

I quickly get bogged down and figure why reinvent the wheel? Well, maybe because all the wheels I can find are the wrong size.

*sigh* Learning learning learning. This may be all that's keeping me from getting unhealthy.

Comments? Tweet  

Topsy vs. Twitter

November 20, 2014 — Greg Haas

Having made one post, then reading through the page source bashblog produces, I found only one change I wanted to make. I want to switch from Topsy to Twitter for "comment" search results. Ultimately, I'd like to not worry about two way communication. Afterall, with a clear and simple URL, folks can tweet on their own and conduct their own searches.

I still have a lot to learn!

Comments? Tweet  

Bashing By Example

November 19, 2014 — Greg Haas

Carlos Fenollosa has written a Bash scrip that handles blog posting.

I want to learn bash scripting, in particular, file handling, to serve up policy files for a school district. I hope to learn from Carlos.

Tags: bash, learn, policy, files

Comments? Tweet