Entries tagged 'lang:en' (Page 33)

Generating Bitmap Files With Bash

Entry created on 2021-10-17 author:steeph (374) cat:Bash (31) cat:Bitmaps (1) cat:Code (31) cat:Computer (78) cat:Linux (36) cat:Scripts (28) cat:Software (53) lang:en (253) top:Projects:Code:Bash Scripts (23)

I needed a large amount of image files to try something. I wanted them to be different images. But what's in them didn't matter. So I looked at a BMP file to see how I could create one byte for byte automatically. Bitmap is just the first uncompressed format that I thought of. This is what I came up with:


rbmp() {
  echo -n -e '\x42\x4D\x2A\x02\x00\x00\x00\x00\x00\x00\x7A\x00\x00\x00\x6C\x00\x00\x00\x10\x00\x00\x00\x09\x00\x00\x00\x01\x00\x18\x00\x00\x00\x00\x00\xB0\x01\x00\x00\x23\x2E\x00\x00\x23\x2E\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x47\x52\x73\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x'
  c=$(</dev/urandom tr -dc '0123456789ABCDEF' | head -c864 | sed 's/.\{2\}/&\\x/g')
  echo -n -e "$c"'00'
}

Or, if you would like to do run a command for each pixel/color before it is generated, you can do it like this:


# Create a 24 bit bitmap file of 16x9 randomly colored pixels
randombmp() {
  echo -n -e '\x42\x4D\x2A\x02\x00\x00\x00\x00\x00\x00\x7A\x00\x00\x00\x6C\x00\x00\x00\x10\x00\x00\x00\x09\x00\x00\x00\x01\x00\x18\x00\x00\x00\x00\x00\xB0\x01\x00\x00\x23\x2E\x00\x00\x23\x2E\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x42\x47\x52\x73\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
  i=1
  while (( i < 433 )); do
    c=$(</dev/urandom tr -dc '0123456789ABCDEF' | head -c2)
    echo -n -e '\x'"$c"
    i=$((i+1))
  done
}

I'm sure I did something wrong. I just copied the header of some BMP file with the right format that I don't even know what it was created with. I didn't actually look up how the header of a BMP file is composed. But it worked.

Entry created on 2021-10-16 author:steeph (374) cat:Opinion (9) cat:Personal (12) cat:Technology (5) cat:Thoughts (71) lang:en (253)

I feel like I'm not using modern technology and other privileges that are available to me today to it's full potential. I think that nobody is even able to. I mean, I'm sitting here on a bench in the fields writing a blog entry and uploading it to "my" web server via SSH, listening to an independent web radio over the internet in-between browsing the web (that really is almost world-wide) for any information that interests me at that moment, with a "phone" capable of so much more than I would have thought 20 years ago even desktop computer should be able to do. But still, so much would be possible with today's technology (mainly the internet and small, battery powered devices). Humanity, what are you doing, wasting your own inventions? steeph, what are you doing wasting your time and resources on listening to some random person talking about something just because it fulfils your momentary desire for information about that topic while typing this sentence?

Lucid dream induction really is easy when it's not hard.

Entry created on 2021-08-29 (edited 2021-10-15) author:steeph (374) cat:Dreaming (9) cat:Lucid Dream Induction (3) cat:Lucid Dreaming (12) cat:Research (3) cat:Science (6) lang:en (253)

Becoming conscious of your dream state while dreaming is in a category in my mind that I call "like stopping smoking". It isn't like stopping smoking in many other ways. But in a way it is similar. There is no obvious requirement in order to achieve one of those goals. You just have to do it and it's done. As far as clearly formulatable instructions go, that's it. Just remember to notice the next time you're dreaming and you'll become aware. The first ever defined, written down and named lucid dream induction technique, based on the research of and published by Stephen LaBerge, is based a great deal on this assumption. MILD (Mnemonic Induction to Lucid Dreaming) is one of the most widely known lucid dream (LD) induction techniques. But it often is condensed so much that it loses most of its important instructions in the most popular online guides. For a complete picture with all the practical exercises the, as it were, original description from the book Exploring the World of Lucid Dreaming (book scan) is still the best introduction and guide to this induction technique and probably always will be.

I've used many different techniques to induce lucid dreams over in my time. Some with more success, some with less, some without. After a few years of regular practice, I've come to focus on a hand-full of techniques and personal adaptions of published techniques that seemed to help me best achieve my dream goals. Almost everybody who does intense and/or prolonged lucid dream practice seems to get to a point where they find "their" technique(s) or combination(s). That makes sense because people's life's are structured differently and different personalities and preferences presumably make different techniques more successful than others. But no LD induction technique is surefire. Apart from few counterexamples every dreamer wakes up with no new memory of dream lucidity more often than with a new success. It's an ubiquitous subject on every lucid dreaming forum and a inherent part of lucid dreaming practice. Becoming lucid every night is just not a realistic goal for most dreamers, no matter how hard they wish and try.

A lot could be said (and is said elsewhere) about the best approach and the right mind-set for lucid dream induction. I could write a huge review of different approaches, techniques and practices based on my own experiences. But I don't think that this would be much more helpful than the countless blog entries and forum posts about other dreamer's experiences. They are my experiences. Parts of them may overlap with useful tips that you can find in other posts and guides. But they are as likely to be helpful to you specifically as any other honest, optimistic step-by-step guide on the net, which is usually not at all. I could write a review of scientific studies and what practical instruction one could derive from them that have the highest likelihood of helping a large percentage of lucid dreamers looking for instructions. But such a review wouldn't be huge because the amount of comparable studies on the efficiency of LD induction techniques is tiny. The amount of research on the subject isn't large as it is, especially well-design studies, especially with more than a few participants. And the methodology used differs in almost every single study. That's why I so easily accept the fact that the lucid dreaming community still creates knew "knowledge" almost exclusively based on the sum of many individual anecdotes. The sum differs for everybody, based on what web sites they read and which posts they read and skip. Helpful practices emerge out of repetition of self experiment and the amateurish and biased publications in the form of short forum posts and incomplete and deformed retellings. As with mutations in other areas (with which I struggle to compare these memetic changes), prolific evolution is incredibly rare, which is why every dreamer with the wish to be able to become more lucid in their dreams or to have more lucid dreams is still stuck with blindly trying all sorts of practices without immediate feedback of progress or success.

I want to believe that there is some element in the variety of dreamers and LD induction attempts that plays such a large role in deciding the outcome of intentional attempts to obtain conscious experiences in dreams that managing this possibly yet unknown element would lead to a drastic rise in the success rate of such attempts. I'm far from being able to ascertain what this proposed element could be, if there was one. I'm just someone reading interesting sounding research papers and forum posts on lucid dreaming and experimenting with my own dreams. But to make my thought more intelligible, here is an idea how this could look like.

Because I'm in no way knowledgable in either neurology nor psychology I'll keep it short and broad, in the hopes of not saying too many too stupid things. Brain chemistry plays a big role in how we consciously experience the world. No lucid dreamer (at least not that I've heard about) knows what's going on chemically in their brain when they do their practice. They don't know how the repeated practice influences brain chemistry and they don't know what was chemically different in their brain during their successful induction attempts compared with their unsuccessful induction attempts. No lucid dreamer takes regular blood tests to learn something about the stuff that is pumped through their brains when they go to bed. Drug use is a common topic among some interested lucid dreamers and some medications have been proven to increase the LD frequency. But that's just a few medications that were tried because it seemed likely that they might have this affect based on what whas already known about them, mainly about their side effects when used with other intents. Remember: I don't know anything about neurology. But I can't help but think that intuitively it seems to me that there must be a large untapped potential for lucid dream research that could make dream consciousness easier to achieve.

Please don't hold back if you want to tell me how wrong I am. Especially if you want to tell me why I'm wrong. :)

USB/Serial PWM Fan Controller Using an Arduino

Entry created on 2020-11-22 (edited 2021-10-15) author:steeph (374) cat:Arduino (4) cat:Case Modding (11) cat:Code (31) cat:Computer (78) cat:DIY (17) cat:Electronics (16) cat:Fans (1) cat:Hardware (16) cat:Projects (41) cat:incomplete (21) lang:en (253) top:Projects:Arduino (4) top:Projects:Case Modding (9)

I wanted to be able to control the speed of the fans in my big NAS, Fred, individually. Even though the mainboard in use has five PWM fan connectors, the chipset can only control the speed of all fans together. There are probably good fan controllers commercially available that solve this problem better than I did. But they seemed overpriced and it seemed like a fun learning project for me.

The fan controller that I made uses an Arduino Nano clone that listens to it's serial port, waiting for a command to change the speed of a fan. When a command is recognised the continuous PWM signal for that fan is changed accordingly. It's possible to control up to six fans this way with an Arduino Nano. I'm only using three though since I only have three fan groups that need to be controlled separately.

The Arduino sketch/C code for the Arduino Nano that I used is as follows.




//fan speed sensor wire attached to digital pin 2 with a 10kohm pullup resistor
//fan PWM control wire attached directly to digital pin 9

#include <PWM.h> //include PWM library http://forum.arduino.cc/index.php?topic=117425.0

volatile int half_revolutions1; //allow half_revolutioins to be accesed in intterupt
volatile int half_revolutions2; //allow half_revolutioins to be accesed in intterupt
int rpm1; //set rpm as an integer
int rpm2; //set rpm as an integer
int pwm=255;
const byte numChars = 5;
char receivedChars[numChars];

boolean newData = false;

void setup()
{
  InitTimersSafe(); //not sure what this is for, but I think i need it for PWM control?
  bool success = SetPinFrequencySafe(9, 25000); //set frequency to 25kHz
  pwmWrite(9, 51); // 51=20% duty cycle, 255=100% duty cycle

  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  analogWrite(5, 170);
  analogWrite(6, 255);
  pinMode(2,INPUT_PULLUP); //set RPM pin to digital input
  pinMode(3,INPUT_PULLUP); //set RPM pin to digital input
  half_revolutions1 = 0;
  rpm1 = 0;
  half_revolutions2 = 0;
  rpm2 = 0;

  Serial.begin(9600);
}



void loop()
{
  sei(); //enable intterupts
  attachInterrupt(0, fan_rpm1, RISING); //record pulses as they rise
  delay(1000);
  detachInterrupt(0);
  attachInterrupt(1, fan_rpm2, RISING); //record pulses as they rise
  delay(1000);
  detachInterrupt(1);
  cli(); //disable intterupts

  rpm1 = (half_revolutions1/2)*60;

  Serial.print("1");
  Serial.println(rpm1);

  rpm2 = (half_revolutions2/2)*60;

  Serial.print("2");
  Serial.println(rpm2);

  rpm1 = 0;
  half_revolutions1 = 0;

  rpm2 = 0;
  half_revolutions2 = 0;

  pwm = 255;
  recvWithStartEndMarkers();
  processCommand();
}

void fan_rpm1()
{
  ++half_revolutions1; //increment before returning value
}


void fan_rpm2()
{
  ++half_revolutions2; //increment before returning value
}


void recvWithStartEndMarkers() {
    static boolean recvInProgress = false;
    static byte ndx = 0;
    char startMarker = 's';
    char endMarker = '\n';
    char rc;
 
    while (Serial.available() > 0 && newData == false) {
        rc = Serial.read();

        if (recvInProgress == true) {
            if (rc != endMarker) {
                receivedChars[ndx] = rc;
                ndx++;
                if (ndx >= numChars) {
                    ndx = numChars - 1;
                }
            }
            else {
                receivedChars[ndx] = '\0'; // terminate the string
                recvInProgress = false;
                ndx = 0;
                newData = true;
            }
        }

        else if (rc == startMarker) {
            recvInProgress = true;
        }
    }
}

void processCommand() {
    if (newData == true) {
        Serial.print("s");
        Serial.println(receivedChars);
        switch (receivedChars[0])
        {
            case '1':
                receivedChars[0] = '0';
                sscanf(receivedChars, "%d", &pwm);
                analogWrite(5, pwm);
                break;
            case '2':
                receivedChars[0] = '0';
                sscanf(receivedChars, "%d", &pwm);
                analogWrite(6, pwm);
                break;
            case '3':
                receivedChars[0] = '0';
                sscanf(receivedChars, "%d", &pwm);
                
                break;
//            default:
//                Serial.println("I don't know what that means.");
        }
        newData = false;
    }
}

Well, how should I put it? It works, usually.

(tbc?)

(tba:photos)

Definition Of Summer

Entry created on 2021-09-11 author:steeph (374) cat:Definition (1) cat:Silly (29) cat:Skin (1) cat:Summer (2) lang:en (253)

Summer is the aggregate of all nights in which you can lay in wet grass at 3am and enjoy a fresh wind on your bare skin.

Go To Navigation Page
Show/Hide Navigation