draft0 - a shared blog by just some people

Menu

Entries tagged 'cat:Scripts' (Page 2)

SBWG 0.8.9

Lately I'm making only slow progress with SBWG. I'm determined to make this something that I'm comfortable with sharing as 1.0.0 online. Something that works and could arguably be called a somewhat finished peace of software. That doesn't mean that the todo list won't be huge at the point I change the version number to 1.0.0. But it should be in a relatively good state for what I've decided it will encompass at version 1.0.0. "Relatively" because it's still also a learning project and I would write many things differently if I started over, which means I'll have to rewrite them at some point to be satisfied with SBWG.

So, the goal and roadmap is set for v0.9.0 and v1.0.0 and a large part of what is still to be done is documentation and other things I don't enjoy doing as much as starting to implement new features. I'm holding back on working on things that are not on that roadmap so that I don't introduce new bugs and the need of further testing. First I want to improve what SBWG can already do.

That means that there won't be many interesting changes in the coming weeks (or maybe even months). Today I've decided to call what I've currently got version 0.8.9 and publish it on the project page.

Comment via email

SBWG update - version 1.0 takes shape slowly

I rarely wrote updates on SBWG before now. I just worked on it whenever I had time and felt like it. And that was quite often. But this is my website where I want to feel fine with pretending that what I'm posting is of any real interest to anybody. So I may post more updates on what I did to approach my goals for SBWG 1.0 from now on. It is rare for me that I invest so much time in a single project. And since I'm starting this blog at the same time and want to fill it with a lot of content, it is time to combine the two.

Some things that I did and changed but didn't report on so far: The header format of entry and page source files has been changed completely (simplified), the generated HTML became more complete, the idea of a sourced settings file came (first to me, then reality), new tag types have been formed, the sorting of blog entries is much more mature now, many more customisation possibilities cropped up and I developed an overall vision of what SBWG will become.

The code grew so much over the time. But it was mostly for very good reasons. I'm feeling overall quite content with how clean the code became and how many contingencies I took into account. It's probably still not "professional" code. But it is a new level of professionalism for me and my Bash scripts. Should I ever come close to getting through all the tiny, small, irrelevant, important, stupid, huge, new and old to-dos, it would probably be quite presentable. So many small features have been added that I hadn't thought of when I startet to write SBWG. Multi-author blogs are supported now, tags can be substituted for icons, a basic RSS feed works, ...

Comment via email

SBWG - Topic Tagpage Sorting

The way tagpages of topic (top:) tags are displayed is pretty much complete and the way I intended it to look when I first thought of splitting blog entry tags into two tag types. Basically, categories (cat: tags) are like classic tags in blogs: a way to add keywords to entries and list all entries that are tagged with that keyword. Topic tags on the other hand are meant to tag entries that talk about a certain topic about which a visitor might want to read up regardless of when individual entries on the topic have been posted. A topic tapage represents an index on a topic. It lists all the entries that are relevant to the topic in a structured way. You could write a book, one chapter per blog entry and have it simultaniously presented as a weblog (with category tags) and as a orderly indexed book in which visitors up a certain chapter. I still have to make up my mind on how I want to structure my own blog entries. But the fuctionality in the software is there. I will very likely also add another feature that enables structuring entries and pages into custom menues. So the options for web site builders will be grand with this weird took.

Comment via email

SBWG 0.8.6-wip

By now the initial introduction of SBWG that I've written in the first entry in this category is not only incomplete but in its details largely obsolete. SBWG matured a great deal in the last months and I feel like publishing a new version. I have started documenting stuff properly in the README and other files included in the package since I have a set goal for version 1.0. I will likely add no new features until I have made something that I can satidfyingly call version 1.0. Right now I'm in between versions 0.8.6 and 0.8.7. I call in-between version wip (work in progress). I feel like publishing what I have so far right now. So here is a wip version: 0.8.6-wip.

Comment via email

Bash Dotfiles

I've finally taken some time to overhaul my dotfiles. I took a lot from git repositories and reddit posts that I've found and added some functions and aliases myself. I'm using Bash 4 and haven't tested any of this with any other shell. I've removed and redacted personal lines.

.bashrc

.bash_profile

.bash_aliases

.bash_functions

.bash_options

There are a lot of dotfiles that other's have shared that would be worth sharing here. But it's easy to find those and I don't know what you'd like or not. So I'll point out just one simple project, "Sensible Bash by Mattia Tezzele, that attempts to set saner Bash defaults.

Comment via email

moviefy.sh - Make Bash Output like It's The 80s And We're In Hollywood

Source this script in Bash to make unformatted output of commands appear on screen slowly, accompanied by beeping galore.

source moviefy.sh or . moviefy.sh. Every command executed after that will be moviefied. There is no way to turn it off again. (Just exit.) Please note that formatted output may be mangled or it may crash the script. Curses stuff won't work.

#!/bin/bash

export LC_ALL=C
exec > >\
(while IFS= read -d '' -r line; do
  if [[ -n $line ]]; then
    echo
    for (( i=0; i<${#line}; i++ )); do
      char="${line:$i:1}"
      printf '%c' "$char"
      case $char in
        [" "]) sleep 0.04
               ;;
        [$'\t']) sleep 0.08
                 ;;
        [$'\v']) sleep 0.7
                 ;;
        [$'\n'$'\r'$'\f']) sleep 0.25
                           ;;
        *) beep -f $(shuf -i 3000-3200 -n 1) -l 5
           sleep 0.015
           ;;
      esac
    done
    printf "${PS1@P}"
    printf ""
  fi
done)
PROMPT_COMMAND='printf "\0"'
Comment via email

Backup Shell Script

This entry is an update of the entry 'Automatic backups with rsync under Linux'.
There is a newer version of this entry: 'backup.sh'.

This is an outdated version of my backup script. I've posted a newer version here.


Here is an updated, more versatile version of the simple backup script I posted before. It takes arguments now (wow)! So now you need only one backup.sh and in your cron tab or similar you can pass it the directory you would like to back up.

For example backup.sh /home/user UsersHomeDir will back up the home directory of user to the predefined location.

In preperation you only need to mount the drive you would like to back up to and enter the mount point (or a path inside it) at the top of the script (variable $BUDIR). In this destination folder (which can be an external drive or a NAS) backups are organised in directories named by the host name of the machine the script was executed on and the name of the backup job (the second argument). By default it will keep 8 incremental backups per backup name. This can be changed with the variable $NUM.

If you give the script only one argument it will interpret it as a name of a file that contains the directories that you want to back up.

If you pass no argument to the script it will look for such a file in the location that is pre-defined at the top of the script (variable $LIST).

You can download the script here if you want to.

Comment via email

Automatic backups with rsync under Linux

There is a newer version of this entry: 'Backup Shell Script'.

This is a very primitive and bad script. I've posted a new version here.

"No backup no pity!"

I don't agree. But I like the saying for reasons that I shall not analyse here right now.

I don't always have proper backups of my data, let alone off-site backups. I have no backup at all of a large portion of my hoarded data. But I did at some point take the time to create scripts that back up important stuff automatically. Here is a simple one using rsync and a mounted share as a target.


#!/bin/bash

NAME="usershomedir"
SRCDIR="/home/user"
BUDIR="/mnt/backup/"

rm -rf $BUDIR$NAME.8
mv $BUDIR$NAME.7 $BUDIR$NAME.8
mv $BUDIR$NAME.6 $BUDIR$NAME.7
mv $BUDIR$NAME.5 $BUDIR$NAME.6
mv $BUDIR$NAME.4 $BUDIR$NAME.5
mv $BUDIR$NAME.3 $BUDIR$NAME.4
mv $BUDIR$NAME.2 $BUDIR$NAME.3
mv $BUDIR$NAME.1 $BUDIR$NAME.2
cp -al $BUDIR$NAME.0 $BUDIR$NAME.1
NOW=$(date)
echo >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
echo "##### STARTING INCREMENTAL BACKUP AT $NOW" >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
rsync --archive -L --delete $SRCDIR  $BUDIR$NAME.0/ 2>&1 | tee -a $BUDIR$NAME.log

You would create one of these scripts per directory you want to backup. BUDIR is the directory where you want to backup to be stored. This will probably be the same for every script if you have only one backup drive/server. SRCDIR is the directory you want to backup. NAME is the name you want the backup to be stored under. It can be a sub-directory if you want, so you can sort the backups into directories on the target.

Comment via email
Mastodon