linux
Entries tagged: linux-
May 24, 2020.
Why even own a Raspberry Pi?
tags: linux, 100days
When I first got my Raspberry Pi, I was convinced it’ll be my personal smart home device. I was thinking of all the neat projects I’d do with the hardware bits. You know, the GPIO pins and the USB ports. Not to mention the onboard wifi card, which would save me from having unsightly wires taped around my apartment.
It’d be just like an Arduino but also Linux.
Software is the worst
Arduino is really easy because everything’s set up for you. You don’t need to worry about versions or support because you’re pretty sure that your Arduino supports Arduino code.
Not so with Raspberry Pi and Linux distros. As soon as you’re worrying about a Linux machine, you have a million moving parts that all depend on each other.
To get to the point, I spent weeks trying to figure out how to interface with the GPIO pins. There are a handful of GPIO python libraries. I think I tried a C library as well. None of them worked. I’m pretty sure it was a firmware problem, or something involving kernel extensions.
At that point, I gave up trying.
Having a personal Linux server is pretty great
So instead of a smart home toy, my personal Pi is just a general-purpose Linux server. I have a Syncthing relay running on it, as well as various game servers. It’s also a music library (which plays via Bluetooth) and a general-purpose database server. At some point it was running a Discord bot and a Phoenix site. If I wanted to, I could run a Pi-hole, or seed torrents, or do whatever you people do with a general-purpose headless Linux box.
Most importantly, it’s a nice playground for various Linux toying and misdeeds. A lot of my often-used commands.md notes were a direct result of Pi hacking.
It’s pretty great, even if only because I don’t need to rent any more Amazon EC2 boxes (for whenever I need a 24/7 Linux box).
Is it worth it?
No. Yes. My expectations for the Raspberry Pi weren’t exactly met, but I’ve gotten enough use and learning out of it to justify the $35 price tag.
I’m writing this as part of #100DaysToOffload. You can directly check out other participating blogs or take part yourself.
tagged: linux, 100days Why even own a Raspberry Pi? (permalink) (tweet)
-
modified June 25, 2020.
commands.md
tags: linux
I keep around a file called
commands.md
which is a gigantic list of tiny how-tos. Whenever I catch myself spending forever finding the right commands to run, I add to this list.Here are some of those how-tos that I find myself referencing all the time. (newest first)
Compress pngs
for file in *.png; do pngcrush -ow "$file"; done
Compress gifs
gifsicle -O3 --colors 256 --batch -i *.gif
Setting up swap
Storing 1024 * 1M of swap in
/var/swap.1
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=1024 sudo chmod 0600 /var/swap.1 sudo /sbin/mkswap /var/swap.1
Enable:
sudo /sbin/swapon /var/swap.1
Add to
/etc/fstab
to start swap on boot:/var/swap.1 swap swap defaults 0 0
(from https://stackoverflow.com/a/17173973)
Set a debugger breakpoint before page reload
addEventListener('beforeunload',()=>{debugger})
Patch pip packages from source
e.g. for
https://github.com/rkern/line_profiler
:git clone https://github.com/rkern/line_profiler.git find line_profiler -name '*.pyx' -exec cython {} \; # do some edits cd line_profiler && pip install . --user
Installing AUR package from source (PKGBUILD file)
make sure the
base-devel
group is installedsudo pacman -S base-devel
then e.g. for
https://aur.archlinux.org/packages/bluez-utils-compat/
:git clone https://aur.archlinux.org/bluez-utils-compat.git # -s installs build deps, -r uninstalls them after build makepkg -sr # -i installs makepkg -i
other flags you can add to
makepkg -sr
:-A to ignore architecture restriction -c to remove build files after a successful build
bash script: cd to where the script is
cd "${0%/*}"
imagemagick change image white to transparency
mogrify -transparent white image.png
with fuzzy matching:
mogrify -transparent white -fuzz 10% image.png
install packages in octave
e.g. to install
symbolic
:pkg -forge install symbolic pkg load symbolic
add to
~/.octaverc
to load on startup:
tagged: linux commands.md (permalink) (tweet)pkg load symbolic