Tim Habersack

Where I put my things..

My hubris was my downfall

Mar 16th 2022

Hello! So, my blog was offline for a month here, just got it back online. And now, what is this.. ~ 4 years of posts are missing? Well, what happened? Like always, it was a problem of my own creation.

  1. Write own blogging engine
  2. Import years of Wordpress content into it
  3. Be so pleased with it that I don't think to ever back up MariaDB, because my system is flawless!
  4. Set up gitea on the same box
  5. Don't pay attention to the fact that many, many repos are getting added
  6. Storage fills up
  7. MariaDB has a heart attack
  8. I don't realize the space issue, and think maybe I just need to restart box. That has 0 bytes free
  9. Restart box, MariaDB corrupts its data when it tries to restart
  10. Figure out it's a space issue, clear space
  11. Try every trick in the book to restore MariaDB data, but hopelessly corrupted
  12. Give up, set up new instance and move everything over

So, my friends let that be a lesson to you. Back up your content! I do sort of have my archives, but I'll need to manually update this to backfill them. So I expect about 1-2 a week.

Setting up Laradock for multiple projects with Nginx

Jun 7th 2020

Laradock is a handy tool. Basically it has a ton of pre-configured docker containers, and you can pick and choose for the dev environment you need. However, every time I set up laradock on a new system I forget how to set up the directories and configure nginx to properly serve them up.

For example, assume directory structure like:

laradock
project_1
project_2

The default env-example (that you copy and rename to .env) has this info at the top:

APP_CODE_PATH_HOST=../
APP_CODE_PATH_CONTAINER=/var/www

This means laradock thinks anything in the directory above it is data it should access. Within containers, /var/www points to the host o/s ../, the directory that the laradock directory sits in.

So! When configuring laradocks nginx to have multiple sites, you just point the root accordingly.

For example, assume directory structure like:

laradock
project_1
project_2

In the laradock/nginx/sites directory, you'd cp default.conf project_1.conf. (Or anything, the name of the conf file doesn't matter). Edit the project_1.conf like so:

server_name project_1.test;
root /var/www/project_1;

Now (assuming you've altered your /etc/hosts to have 127.0.0.1 project_1.test), when laradock/nginx serves up the project1 site, it will look at your project1 directory for the content!

Let's say project_2 has a structure in it like:

app/
config/
cli/
public/

You'd want nginx to serve up the project_2/public directory.

server_name project_2.test;
root /var/www/project_2/public;

This always trips me up and costs me a little time. Hopefully I'll remember it for next time, and also maybe it will help others.

#laradock #nginx #docker

Getting psf/psf2/spc audio files to play in OSX

Mar 23rd 2018

So, I'm an old man. I love soundtracks from games from older consoles. While yes, you can get mp3s or stream the soundtrack from YouTube, in my opinion the best way is to listen to the original files.

I don't pretend to know how it all works, but talented people can take the game music out of console games into a native-ish format. When you listen to it, the codec basically perfectly recreates the synth/music. For Super Nintendo, it's the spc file. For Playstation 1 and 2, it's a combination of minipsf/psf/psf2 files.

Anyway, I have lots of these original soundtracks. In my Windows OS days long, long ago I would load up WinAmp with all kinds of output plugins to play these kind of media files. Good times.

Then, for various reasons I started using Apple products. There is no WinAmp for OSX, and I could find no way to play my soundtracks of choice. I sighed, grumbled, and moved on.

Then! Then! Like 10 years later I've figured it out, and it's super simple. Audacious is an open-source audio player, and it supports all these older codecs no problem. When you go to their site, it isn't obvious that there's a way to get it to run in OSX, but there is.

You'll need to have Homebrew installed, but you probably should anyway because it's super helpful. Then it's just a matter of:

brew install audacious

And it works!!

Wii Fit is nice.

Jan 10th 2018

I've been starting to do the #Wii Fit Plus almost day.2 yogas, 1 strength and 1 cardio (normally a run). I love it.

Also, living in PNW, seeing that sunny blue sky on the island run really helps with my mood. Yay virtual environments!

Don't always be materially productive

Oct 7th 2017

This is something I ran into for a long period of my life. I recently started a friendship with someone and they expressed that they suffer the similar condition, so I wanted to share my experiences and how I got past it.

It comes down to work and not being able to spend time creating something, or writing something from scratch.

Whenever you have extra time, you're always thinking about the other things you could be doing. Learning something new to further your career, working on some extra work to try to make more money, and so on.

I used to be really stuck in this loop. I had ideas for stories I wanted to write, or games I wanted to develop, but I couldn't do it. Whenever I would maybe have the time to work on it, my brain would always be whispering, "You should be doing this other thing, or you should be learning this other thing. Writing stories is a waste of time. Developing games is just a waste of time."

This is related, although it doesn't seem like it. One time, my wife bought a canvas for me to paint. I've never painted on a canvas in my life up until this point. I decided to paint a science-y kind of picture, just a star field. I did this and it took about two hours, and I was happy with the results. I realized several months after that that during the creation of it, I had none of those whispers of self doubt in my head.

There is fundamentally no difference between painting a picture, or writing a story, or developing a game. I am a software developer, and the way I create is writing software. So, creating a game and working on that game is a form of art. Art doesn't necessarily have to have a financial end, that's not the point of art.

Once I realized this, I found out that I was able to work on small side projects that would in all likelihood not make any money. Whenever the whispers would start to happen in my mind, "You should be working on something that makes money", etc, I could just remind myself that I am a human. It is important for me to make art.

If you have similar whispers, I encourage you to remember.. You are a human! Art is important, and your medium can be whatever you want it to be.

Library not found for -lssl error when trying to pip install things

Aug 4th 2017

Issues when trying to run pip install mysqlclient in OSX 10.12. I was getting:

ld: library not found for -lssl clang: error: linker command failed with exit code 1 (use -v to see invocation) error: command 'clang' failed with exit status 1

Steps to fix:

  • brew uninstall mysql
  • brew install mysql-connector-c
  • brew unlink mysql-connector-c
  • brew install mysql
  • xcode-select --install
  • env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib"

I hope this helps someone else! :)

X11 Error when trying to pip install things

Aug 3rd 2017

Issues when trying to pip install Pillow in OSX 10.12. I was getting:

fatal error: fatal error'X11/Xlib.h' file not found:

Steps to fix:

sudo ln -s /opt/X11/include/X11 /usr/local/include/X11

I hope this helps someone else! :)

The Dishonor of Kaln

Jan 16th 2017
"Quickly, my Queen, we must away!"
the white-cloaked young Knight calls;
sounds of battle grow ever close
down grey stone-pillared halls.

"Protect my Love, and keep her safe"
ordered his Sovereign Lord.
Yet rash heart yearns to stand with King,
to wield unbloodied sword.

Red-robed Queen walks with hurried poise,
guards try to not show fear,
all stop and as one group they froze,
at unearthly scream quite near.

Swiftly they go through stone-arched gate,
towards stables where escape await.

Within stable, hearts fill with hope,
welcome scent of fresh straw.
As all make ready to depart,
Knights fervor does still gnaw.

Escape in sight, the Knight did speak,
"I must defend my King."
The Queen upon her horse looked down
and sadly touched her ring.

"If you must, you must."she quickly said
and spun around her steed.
With clear command, "Onward!" she spoke.
They rode away at speed.

Towards throne room and King, Knight does head,
Where glory, honor lie ahead.

Round last corner, young Knight turns,
into a ghastly scene.
Knights and guards litter the floor,
Of Throne room once serene.

Dark-armored figures press forward,
toward fearless sword-drawn King.
As Knight rushes towards desperate fight
Kings sword halts in mid-swing.

He shouts "You should have kept her safe!"
Face shows his trust betrayed.
Distracted thus, his heart is pierced
Ran through by black-swords blade.

The young Knight pales; what has he done?
Towards Queen and duty he doth run.

Footfalls echo in empty halls
as Knight retraces route.
With sword in hand, his keen eyes scan,
aware of foes about.

With caution peeks in stable door,
no enemies inside.
To Queens escape, southern moon gate.
Upon black steed he rides.

At silvery gate he leaps from horse,
the steed, in protest neighs.
He runs past bodies, broken spears.
In shock he stops, dismayed.

On road, Queens robe is torn in parts.
In tatters, matching Knight Kaln's heart.

How to get the final url after redirects

Nov 14th 2016

Sometimes, you have a link. And you want to save the actual, final url that link points to. A great example of this is trying to archive something on twitter. You'll want to store final urls for ones that are tweeted, not their url shortened one.

Anyway, I wrote this really quick in PHP and it works!


$d['initial_url'] = 'https://t.co/NOKpf0iHpR';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $d['initial_url']);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_URL, $d['initial_url']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_AUTOREFERER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, 50);
curl_setopt($ch, CURLOPT_MAXREDIRS, 10);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_exec($ch);
$d['final_url'] = curl_getinfo($ch, CURLINFO_EFFECTIVE_URL);
print_r($d);

This outputs:

Array
(
    [initial_url] => https://t.co/NOKpf0iHpR
    [final_url] => https://tim.hithlonde.com/2016/announcing-js-space/
)
Nov 8th 2016

I just installed Counter-Strike: Source, and I am not sure why. I think it's because I want to see cs_italy again and hear that music just one more time..

< Older Newer >