Recent posts

#1
Software / Launch or Bring to Front and L...
Last post by Ampera - January 26, 2022, 08:47:23 AM
Small helper scripts

"laorbtf" (Launch or Bring to Front)


#!/bin/sh

if [ "$(pgrep $1)" == "" ]; then
        exec $1 &
else
        wmctrl -a $2
fi


Needs wmctrl. First argument is command/process name, second argument is window class/name

"laifnr" Launch if Not Running


#!/bin/sh
if [" $(pgrep $1)" == "" ]; then
        exec $1 &
fi


First argument is name of the command/process name
#2
Foodposting / FOTD: Mushroom Pizza
Last post by Ampera - July 29, 2021, 04:24:35 PM





Been a while since I've done one of these. Maybe I'll write down specifically what I did, but I'm still toying with it. The dough is store bought, and the sauce is made from canned tomato puree for those wondering.

Mushroom, Mozzarella, Parmesan on the top.
#3
Announcements / Great Big Server Move!
Last post by Ampera - May 23, 2021, 09:35:33 AM
As of writing this, I have (mostly) finished moving these here forums onto a new server I recently acquired.

For the longest time, this, and pretty much everything else I did was running on an old single socket HP workstation board with a 6 core Westmere-EP Xeon (X5650). It was alright for the little I did with it, but I always felt cramped by the single system, since a reboot for some other project would mean taking /everything/ from IRC to game servers, to the website and db server down.

So, I ended up seeing an HP Proliant DL580 G7 for a good price, and bought it. Oh boy was that an experience. I may do a more in-depth forum post on it later, but I'll at least leave a picture here:



This was a crazy project, which includes 10GbE fiber, cutting and terminating my own CAT6, and even getting 240V outlets wired up. No fires, thankfully, and a lot of fun and I've learned a great deal. The site may go down a few more times while I test things, but should be fairly stable soon enough.
#4
General / Re: Bash mandelbrot
Last post by Ampera - April 05, 2021, 11:29:31 PM
Neat, works quite well on xterm
#5
General / Bash mandelbrot
Last post by electrohead - April 04, 2021, 01:14:34 AM
Had this laying around in my random scripts directory, figured you'd like this, for the heck of it. Cheers.


#!/bin/bash

#############################################################
#                                                           #
# Program:      mzoom                                       #
# Author:       dw                                          #
# Date:         2007-07-07                                  #
# Purpose:      Explore the Mandelbrot set in bash!         #
# Usage:        See below                                   #
# Version:      1.01.6930                                   #
#                                                           #
#############################################################

#### Usage: Run with no arguments, program will draw full mandelbrot set. After set is complete,
#### use the arrow keys to navigate to the upper left corner of an area you want to zoom into,
#### then press the "z" key once, use the right arrow key again to move to the right, you are now
#### deciding how big of a "box" to draw around the area, when you are far enough to the right,
#### press the "z" key one more time, this will draw a box roughly around the area to be zoomed
#### into, after a brief pause, the program will zoom into the area you selected. Repeat process
#### to continue zooming, use control c to exit.

#### As your level of zoom increases, you'll want to increase the number of iterations, you can
#### do this by pressing the "i" key while in zoom mode, anytime before pressing the second "z",
#### this will increase the max iterations by 50 each time.

#### This program uses integer math to explore the Mandelbrot set, it will not zoom in as far as
#### a "real" Mandelbrot explorer, but floating point was just too slow in bash, you'll know when
#### you hit the limit, I have tested it to about 2,000,000 magnification. My bash/python hybred
#### version zooms much further and is over 40 times faster. :-)

#### GET CURRENT SCREEN SIZE - METHOD 1
w=`tput cols`
e=`tput lines`

#### DO WE HAVE A SCREEN SIZE? IF NOT, TRY METHOD 2
if [ ! "$w" ]
then
  #### GET CURRENT SCREEN SIZE - METHOD 2
  w=`stty -a | grep rows | awk -F ";" '{print$3}' | awk '{print$2}'`
  e=`stty -a | grep rows | awk -F ";" '{print$2}' | awk '{print$2}'`
  #### HOW ABOUT NOW?
  if [ ! "$w" ]
  then
    clear;echo;echo "COULD NOT OBTAIN SCREEN SIZE";echo;exit
  fi
fi

#### SET MAX X & Y
((w = w - 1));((e = e - 1));maxy="$e";maxx="$w"

#### SETUP THE COLOR VARIABLES
off="\033[0m";gry="\033[1;0m";red="\033[1;31m";grn="\033[1;32m";yel="\033[1;33m"
blu="\033[1;34m";pur="\033[1;35m";aqu="\033[1;36m";wht="\033[1;37m"

#### SET THE BC PRECESION
pre=20

#### SETUP THE MANDELBROT VARIABLES
si=$(echo "scale=$pre;(2.5)" | bc)          ### length of side = 2.5
c=$(echo "scale=$pre;(-2.00)" | bc)         ### acorner = -2
k=$(echo "scale=$pre;(-1.25)" | bc)         ### bcorner = -1.25
it=100                                      ### iterations = 100

#### SETUP THE COLOR ARRAYS
p[1]="$gry";p[2]="$wht";p[3]="$red";p[4]="$grn";p[5]="$yel"
p[6]="$blu";p[7]="$pur";p[8]="$aqu";p[9]="$wht"

nsi=$(echo "scale=$pre;(2.5)" | bc)

#### THE MAIN ROUTINE
mandelbrot()
{
#### FILL THE COLOR ARRAY
  x=1;z=0;xx=1
  while ((x < it))
  do
    ((z++))
   if ((z > 9))
    then
      z=1
    fi
    pix["$x"]="${p[$z]}""$xx"
    ((x++));((xx++))
    if ((xx > 9))
    then
      xx=1
    fi
  done

  #### AUTO CALCULATE ASPECT RATIO
  ar=$(echo "scale=$pre;($w/$e)/2" | bc)
  gr=$(echo "scale=$pre;($si/($w/$ar))" | bc)

  #### MULTIPLIER FOR INTEGER MATH IS 2^27 SO WE USE A 27 BIT SHIFT IN THE MAIN LOOP
  mul=134217728;clear;m=0;n=0;pxl="M";g=`echo "$gr" | awk '{print(int($1*'"$mul"'))}'`
  hr=$(echo "scale=$pre;($si/$e)" | bc);h=`echo "$hr" | awk '{print(int($1*'"$mul"'))}'`
  gcr=$(echo "scale=$pre;(($gr+$c)*$mul)" | bc);gc=`echo "$gcr" | awk '{print(int($1))}'`
  mhkr=$(echo "scale=$pre;(($hr+$k)*$mul)" | bc);mhk=`echo "$mhkr" | awk '{print(int($1))}'`
  ngc="$gc";writexy="tput cup";((mul4 = mul << 2))

  #### PRINT ZOOM RATIO, ITERATIONS AND COORDINATES AT LOWER LEFT CORNER OF SCREEN
  mag1=$(echo "scale=$pre;(2.5/$nsi)" | bc);echo -e "$wht"
  mag2=`echo "$mag1" | awk '{print int($0)}'`
  $writexy $((maxy - 3)) 0;echo -n "       ZOOM = $mag2"
  $writexy $((maxy - 2)) 0;echo -n "    ACORNER = $c "
  $writexy $((maxy - 1)) 0;echo -n "    BCORNER = $k "
  $writexy $((maxy - 0)) 0;echo -n " ITERATIONS = $it "

  #### THE MAIN LOOP WITH 27 BIT SHIFT
  while ((m < e))
  do
    x=1;tput cup $m $n
    while ((x < it))
    do
      ((v = (a * b) >> 27));((a = (aq - bq) + ngc));((b = (v << 1) + mhk))
      ((aq = (a * a) >> 27));((bq = (b * b) >> 27))
      if ((aq + bq > mul4))
      then
        echo -en ${pix[$x]};((x = it))
      fi
      ((x++))
    done
    a=0;b=0;aq=0;bq=0;((n++));((ngc = ngc + g))
    if ((n > w))
    then
      n=0;((m++));ngc=gc;((mhk = mhk + h))
    fi
  done
  echo -en "$off"
}

#### THE ZOOM ROUTINE
zoomin()
{
  zoom=0;x=0;y=0;maxy="$e";maxx="$w";beenhere=0
  read_keys()
  {
    key="";read -sn1 key
    case "$key" in
      A)  ((y--));if ((y < 0));then y=0;fi
          ;;
      B)  ((y++));if ((y > maxy));then ((y--));fi
          ;;
      D)  ((x--));if ((x < 0));then x=0;fi
          ;;
      C)  ((x++));if ((x > maxx));then ((x--));fi
          ;;
      i)  ((it = it + 50));tput cup $maxy 0;echo -en "$red ITERATIONS = $it $off"
          ;;
      z)  ((zoom++));beenhere=1
          ;;
    esac
  }

  while ((zoom != 2))
  do
    if ((zoom == 1)) && ((beenhere == 1));then x1="$x";y1="$y";beenhere=0;fi
    if ((zoom == 2)) && ((beenhere == 1));then x2="$x";y2="$y";beenhere=0;zoom=3;fi
    if ((zoom != 2));then read_keys;fi
    if ((beenhere == 0));then tput cup $y $x;echo -en "$wht#$off";fi
  done

  X1="$x1";Y1="$y1";X2="$x";Y2="$y";Y1org="$Y1";X1org="$X1";X2org="$X2"

  if ((X1 >= X2));then clear;echo;echo "X2 MUST BE GREATER THAN X1";echo;exit;fi

  #### DRAW CRAPPY BOX
  ((dif = X2 - X1));xx="$X1";((xxx = xx + dif));tput cup $Y1 $X1
  while ((xx < xxx))
  do
    ((xx++));tput cup $Y1 $xx;echo -en "$wht#$off"
  done

  xx="$Y1";((xxx = xx + (dif >> 1)));tput cup $Y1 $X1
  while ((xx < xxx))
  do
    ((xx++));if ((xx > maxy)); then xxx="$maxy";fi
    tput cup $xx $X1;echo -en "$wht#$off"
  done

  Y2="$xx";((xx = X1));tput cup $Y2 $X1;((xxx = X1 + dif))
  while ((xx < xxx))
  do
    ((xx++));tput cup $Y2 $xx;echo -en "$wht#$off"
  done

  xx="$Y1";((xxx = xx + (dif >> 1)));((X1 = X1 + dif));tput cup $Y1 $X1
  while ((xx < xxx))
  do
    ((xx++));if ((xx > maxy)); then xxx="$maxy";fi
    tput cup $xx $X1;echo -en "$wht#$off"
  done

  #### SET COORDINATES FOR ZOOMED IN AREA
  nc=$(echo "scale=$pre;(($X1org*$gr)+$c)" | bc)
  nk=$(echo "scale=$pre;(($Y1org*$hr)+$k)" | bc)
  nsi=$(echo "scale=$pre;(($X2org-$X1org)*$gr)" | bc)
  c="$nc";k="$nk";si="$nsi";ngc=0;mhk=0;gc=0;hk=0
  sleep 1
}

#### THE INFINITE LOOP
while [ 1 ]
do
  mandelbrot
  tput cup $maxy 0;echo -en "$grn READY TO ZOOM IN       $off"
  zoomin
done
exit
#6
Foodposting / Re: FOTD: Bratwurst with home ...
Last post by electrohead - April 04, 2021, 01:05:42 AM
This needs more sausage.

(That's what she said.)
#7
Foodposting / FOTD: St. Louis Ribs w/ Hash B...
Last post by Ampera - October 06, 2020, 02:04:21 PM




I found a couple racks of ribs at my local supermarket, two for the price of one, so despite being pre-rubbed and seasoned, they were only 7.20 a rack. As had been pointed out, they do have smoke flavor added, but that doesn't mean I can't smoke it myself too.

The smoker used is an electric smoker I got from my local Aldi for 80 bucks. For only 80 bucks, it's been reliable, and delivering of lots of tasty food.
The wood used is willow wood I cut into strips myself. This came from a branch we cut down from a tree in our back yard, of which I saved a few pieces for smoking. As a wood I'd compare it to be similar to maple wood, not particularly harsh, but it's still a very flavorful wood, beyond something like apple.

I did nothing to the ribs until they had cooked a while in the smoker, at which point I applied some hickory flavor Ray's no sugar added barbecue sauce. Everything just as simple as can be.

The sides, as seen in the last picture, are hash browns (frozen from a bag, done on a sheet pan in the oven) and box mac & cheese. The result is as good as it looks, the ribs even had a bit of bark on them. Total smoking time was around four hours, two at 175F, one at 200F, and one at 230F (roughly)
#8
Foodposting / FOTD: Cheeseburgers with bacon...
Last post by Ampera - September 15, 2020, 07:23:49 PM













Lots of images, but otherwise nothing crazy. Quarter pounder patties with sharp cheddar slices, topped with bacon and mushrooms, catsup and dijon, served with a side of home fries.
#9
Foodposting / FOTD: Penne w/ Sausage and Mus...
Last post by Ampera - August 24, 2020, 01:01:57 PM



Pasta dishes are always nice, especially when they're just lob things together and make something delicious.

This is penne with chopped fried bratwurst, baby bella mushrooms, condensed cream of mushroom soup, half&half, paprika, GOYA Adobo, onion powder, cayenne pepper, and Worcestershire sauce
#10
Projects / Whittling Project: Trapped Obj...
Last post by Ampera - August 14, 2020, 02:43:37 PM
As one of my stranger pursuits I've taken up whittling/woodcarving, just as something to do with bits of free time, calmly. Some people just do shavings for the heck of it, but I've been during purposeful carvings, and this is my first creation.

By no means is it any good, and there are more mistakes to count. I could take it further, but I'd rather keep it to contrast with what I do next, and so that I can put more time and effort into a second attempt at some point.

The carving is of a trapped object (a sort of rough cylinder here), in a cage.





For my absolute first time ever carving wood ever, this was a particularly complicated idea, but I'm happy that I was able to do it. There are tons of mistakes, and zero finishing time was spent on this, as while I always want to finish what I start, enough noobie marks were made that I'd rather move onto something else, having accomplished what I set out to do.

I did gain excellent knowledge as to how to control the knife, and what does and does not work for carving, and I'm sure given 1-3 more tries I could get something that looks pretty good. In total this took weeks to make, but I only gave it very occasional attention.

If you are interested in doing stuff like this, the best suggestion I can give right now is get good gloves. Mine are advertised as cut resistant, and out of liability I won't say which ones, but get something that's either very thick leather, or is known to not be easy to cut. If I hadn't worn gloves like that, there would be a time or two my fingers would have gotten it.

The knife I used was a Beaver Craft thing I got off Amazon, out of not knowing anything. There are worse knives, but likely they could be found with the plastic cutlery at Boston Market. It's soft steel (at least my swarmy file could nick it), and holds an edge like someone without hands holds a glass. Despite only cutting soft basswood, there are already small chips in the blade. It's also a sideways knife (not a chisel), meaning a lot of awkward cuts and angles are just not easy to do.

I've thought about making my own blades specifically for this, why not pick up one hobby while doing another, but I'd need to get some equipment for that.

Until then, this was a fun thing to do, and I hope I'll get more carvings. I have plenty of wood blanks, and can always get more.