Strobe Light – Bash Script Edition

Here is a fun little script I put together that will turn your monitor into a strobe light via xbacklight. It also requires yad for the initial graphical configuration dialog. (It facilitates a little more complicated forms than zenity.)

On Ubuntu-based distros you should be able to simply run “sudo apt install xbacklight” and “sudo apt install yad” in the terminal. Here’s a download link for the script: Here.

You can then set its perms to make it executable and run it from the desktop.

Here’s the source:

#!/bin/bash
declare -a settingsArray
let nCount=0
settings=$(yad --title="Strobe Light" --form --align=right --field="  Lower Brightness" --field="  Upper Brightness" --field="  Flash Length" --field="  Interval Length" "0" "100" "0.05" "0.1" --button="Run:0" --separator=' ')
ret=$?

[[ $ret -ne 0 ]] && exit 0

for item in $settings; do
  settingsArray[nCount]="$item"
  let nCount++
done

LowerBrightness=${settingsArray[0]}
UpperBrightness=${settingsArray[1]}
FlashLength=${settingsArray[2]}
IntervalLength=${settingsArray[3]}

function flashScreen
{
  xbacklight -set $UpperBrightness -time 0
  sleep $FlashLength
  xbacklight -set $LowerBrightness -time 0
}

while [[ true ]]; do
  sleep $IntervalLength
  flashScreen
done

Curious Coincidence

shootingstar

The night she died

a bright star fell.

The most brilliant hues

shattered in the night.

She wasn’t breathing;

her breath had left.

Such warmth and light

had filled our home.

Amidst the heavens

a star displaced.

Her leaving leaves

this place colder.

Gummi Bear Wisdom

gummi-banner

Tummi: “What’s it like to be in love?”
[…]
Grammi: “Being in love is wonderful, Tummi! Your heart throbs. Your toes tingle. You get butterflies in your stomach. Sometimes you can’t even eat!”
Tummi: “Ugh, that sounds horrible…”


In this exchange we see some real gummi wisdom. For as C. S. Lewis wrote* in his essay “Transposition”:

“During a moment of intense aesthetic rapture, one tries to turn round and catch by introspection what one is actually feeling, one can never lay one’s hand on anything but a physical sensation… If I were to judge simply by sensations, I should come to the absurd conclusion that joy and anguish are the same thing, that what I most dread is the same with what I most desire.”

The thesis Lewis develops is that our emotional life is more complex and variegated than our literal sensations. In order to be expressed physically, the same sensations may express different emotions–just as simplifying linguistic expression to the point of using the same word for multiple words may be required when translating a work from a language with a broader vocabulary. (I routinely struggle with this kind of “translation” when attempting to converse with management.)

Likewise, just as our emotions are higher and more complex than our sensations, so our spiritual life is richer than either still. Those who have not been awakened to this sensibility may confuse spiritual experience with “simply” emotional states, but that would be a mistake.

In fact, it would be precisely the kind of mistake that Tummi in his own ignorance makes here…




*https://www.cedarville.edu/personal/sullivan/hon3140/readings/lewis-transposition.pdf


Twitch Spam

twitchbanner

Just felt like sharing a script I made for annoying/confusing people on Twitch. If you copy this and paste it in your browser’s console and run it while watching a Twitch stream, the script will post a random string at a set interval of seconds as defined by you in a prompt. The default is 15, and I believe setting it lower than 4 will cause Twitch to complain about you sending messages too quickly.

The strings that get posted at random are defined in the string table “strTable” variable. Just add, remove, or modify as desired. The script will also post back the last thing that anyone wrote in the chat log, addressed to that person and appended with a question mark. (Drawback to this is it could include addressing yourself as well.)

I do have a version that pipes the chat log over to an online bot service and then posts back the result (so people can effectively talk to an AI), but the service in question has API call limitations. To use that script one would have to modify the URLs embedded in the script–as well as have an AI service setup in the first place. I figure if you’re as crazy as me to do all that, then you could probably write the script from scratch yourself anyhow.

Without further adieu, here’s the code…

var i = 0;
var n = 0;
var nInterval = 15;

var strTable = [
"Hearty laughter is a good way to jog internally without having to go outdoors.",
"Marriage lets you annoy one special person for the rest of your life.",
"Never tease an armed midget with a high five.",
"Two days from now, tomorrow will be yesterday.",
"Life is a sexually transmitted condition.",
"Who?",
"I agree with that.",
"Why Lisa, why?!?",
"What a story, Mark! xD",
"I wonder if this script will pass the Turing test...",
"I still can't believe it's not butter!",
"What?",
"That's not how the Force works...",
"Go bake a pie in a fire.",
"Why thank you. Do you have any good jokes?",
"Would you like to know Dean Winchester?",
"Would I like to learn what?",
"What do you wish to lend me?",
"Your mom went to college.",
"Can you are more explicit.",
"Tell me more about your family.",
"You keep using that word; I do not think it means what you think it means.",
"Perhaps your childhood has something to do with this.",
"My pencil is big and yellow.",
"Do you know the babe?",
"That's what she said.",
"Holy rusted metal, Batman!",
"Cactus?",
"Cheesecake!",
"Indeed.",
"I used to be a man like you; then I took a Jenner to my wee.",
"Sometimes I think that dreams are the true reality and life is the simulacrum.",
"I still can't believe it's not butter!",
"No.",
"Just who do you think you are??",
"Do you have any idea who I am?!",
"You don't say?",
"Go on...",
"Really?",
"I know this one.",
"Why was W.S Gilbert frequently drunk on his transatlantic crossings? Because he was quartered... on the *port* side!",
"Blank"
];

nInterval = prompt("Enter the interval (in seconds) for the string randomizer:", nInterval);
if(isNaN(nInterval) || nInterval == null)
{
  alert("Process canceled.");
}
else
{
  alert("Running...");
  setInterval(function() { DoStuff(); }, nInterval * 1000);
}

function DoStuff(nInput)
{
  var iRandomNum;
  var iFlip = 0;
  iRandomNum = randomIntFromInterval(1,strTable.length);

  if(iRandomNum > (strTable.length / 2))
  {
    iFlip = randomIntFromInterval(1,2);
  }

  if(iFlip < 2)
  {
    $(".js-chat_input").val(strTable[iRandomNum]);
    $(".js-chat_input").trigger("change");
    document.getElementsByClassName("button float-right qa-chat-buttons__submit")[0].click();
  }
  else
  {
    RepeatBack();
  }
}

function randomIntFromInterval(min,max)
{
  return Math.floor(Math.random()*(max-min+1)+min);
}

function RepeatBack()
{
  var nLastMsgID = document.getElementsByClassName("message").length - 1;
  var nLastFromID = document.getElementsByClassName("from").length - 1;
  var sLastMsg = document.getElementsByClassName("message")[nLastMsgID].innerText;
  var sLastFrom = document.getElementsByClassName("from")[nLastFromID].innerText;
  if(sLastMsg.substr(sLastMsg.length - 1) == ".") sLastMsg = sLastMsg.substr(0, sLastMsg.length - 1);
  $(".js-chat_input").val("@" + sLastFrom + " " + sLastMsg + "?");
  $(".js-chat_input").trigger("change");
  document.getElementsByClassName("button float-right qa-chat-buttons__submit")[0].click(); 
}