commit 84302400b82de1436dfbe96bb0c58b29e9d2d174 from: Omar Polo date: Sat Oct 03 12:03:48 2020 UTC new post and migrating some content to gemtext commit - 6c1a989de69bde30ef85049da6a55bf0497a74bc commit + 84302400b82de1436dfbe96bb0c58b29e9d2d174 blob - /dev/null blob + da42c5e1336fd0f58bcbec1ab8380c1a0bb86e2b (mode 644) --- /dev/null +++ resources/posts/hello-gemini.gmi @@ -0,0 +1,15 @@ +I've finally decided to invest some time and mess aronud with gemini! + +This post is just an "hello world gemini", to announce that, from now on, this blog will be available also with the gemini protocol. + +=> https://gemini.circumlunar.space/ Project Gemini Website + +I thought for a while on how to make the content available on both HTTP and gemini. Automatically translating markdown (what I used until now) to gemtext is NOT something I want to do, I want pretty first-class gemtext posts, not a best-effort automatic translation. + +So I settle on using gemtext for all the new content. I'll miss some in-line formatting, but the result shouldn't be too bad. I've started to migrate some old content to gemtext too, but not everything is currently available, it'll take some time. + +In order to make this blog both gemini and WWW native, I needed to do other things as well. I'm planning to write some more posts in the future on what I did, but the short version was to write a parser in Clojure for gemtext and a small test gemini server to play. Fortunately someone had already written a major mode for editing gemtext with Emacs. + +=> https://git.carcosa.net/jmcbray/gemini.el gemini-mode.el + +I'm happy with the end results. In particular, using gemtext for the new content will also mean that, in the future, expanding the site to gopher will be easier. blob - caabed0e736b03fe11756c7047e7a1f503ae46b1 (mode 644) blob + /dev/null --- resources/posts/openbsd-tethering.md +++ /dev/null @@ -1,67 +0,0 @@ -These days, for various reason, I'm using USB tethering very often. -Enabling it it's not difficult at all, it as simple as - -```sh -doas dhclient urndis0 -``` - -But it's tedious. Especially if you need to do it multiple times per -day. I needed something to save me from filling my shell history of -`dhclient urndis0`. - -Enter [`hotplugd(8)`](https://man.openbsd.org/hotplugd)! - -`hotplugd` is a daemon that will listen for the attach/detach of -various devices and execute a script. It's that simple, and at the -same time really useful. - -Disclaimer: I don't like to write *howtos* because the man pages are -generally better, and the information in blog like this tends to rot -sooner or later. I encourage you to go read the -[`hotplugd(8)`](https://man.openbsd.org/hotplugd) man page (it's -really short, simple and understandable -- it even has some examples!) -and consider this post as a "did you know?"-sort of thing. - -With the disclaimer in place, let's continue. The idea is that -`hotplugd` will execute `/etc/hotplug/attach` and `detach` script when -a device is attached or detached. It doesn't need to be a shell -script, any executable file will do, but will stick with a plain old -sh script. - -When you enable your phone USB tethering, a new device called -`urndisN` is created. So, knowing this, we just need to execute -`dhclient` inside the `attach` script on the correct `urndis(4)` -devices. Easy peasy: - -```sh -#!/bin/sh -# /etc/hotplug/attach - -DEVCLASS=$1 -DEVNAME=$2 - -case $DEVCLASS in -# network devices -3) - case $DEVNAME in - # USB tethering - urndis*) dhclient $DEVNAME ;; - esac -esac -``` - -Remember to make the script executable and to enable `hotplugd(8)`: - -```sh -# chmod +x /etc/hotplug/attach -# rcctl enable hotplugd -# rcctl start hotplugd -``` - -Every time you enable the tethering on your phone your computer will -automatically connect to it. In theory the same principle can also be -used to automatically mount discs when plugged, but I haven't tried -yet. - -NB: I'm not paranoid enough to worry about accidentally connect to a -stranger's phone. You have been warned. blob - /dev/null blob + cd87fde5ac5a52d34c60a943525d4305b9a4b3cf (mode 644) --- /dev/null +++ resources/posts/openbsd-tethering.gmi @@ -0,0 +1,50 @@ +These days, for various reason, I'm using USB tethering very often. Enabling it it's not difficult at all, it as simple as + +``` +doas dhclient urndis0 +``` + +But it's tedious. Especially if you need to do it multiple times per day. I needed something to save me from filling my shell history of dhclient urndis0. + +=> https://man.openbsd.org/hotplugd Enter hotplugd(8)! + +hotplugd is a daemon that will listen for the attach/detach of various +devices and execute a script. It's that simple, and at the same time +really useful. + +Disclaimer: I don't like to write howtos because the man pages are generally better, and the information in blog like this tends to rot sooner or later. I encourage you to go read the hotplugd(8) man page (it's really short, simple and understandable -- it even has some examples!) and consider this post as a "did you know?"-sort of thing. + +=> https://man.openbsd.org/hotplugd hotplugd(8) manpage + +With the disclaimer in place, let's continue. The idea is that hotplugd will execute /etc/hotplug/attach and detach script when a device is attached or detached. It doesn't need to be a shell script, any executable file will do, but will stick with a plain old sh script. + +When you enable your phone USB tethering, a new device called urndisN is created. So, knowing this, we just need to execute dhclient(8) inside the attach script on the correct urndis(4) devices. Easy peasy: + +``` +#!/bin/sh +# /etc/hotplug/attach + +DEVCLASS=$1 +DEVNAME=$2 + +case $DEVCLASS in +# network devices +3) + case $DEVNAME in + # USB tethering + urndis*) dhclient $DEVNAME ;; + esac +esac +``` + +Remember to make the script executable and to enable hotplugd(8): + +``` +# chmod +x /etc/hotplug/attach +# rcctl enable hotplugd +# rcctl start hotplugd +``` + +Every time you enable the tethering on your phone your computer will automatically connect to it. In theory the same principle can also be used to automatically mount discs when plugged, but I haven't tried yet. + +NB: I'm not paranoid enough to worry about accidentally connect to a stranger's phone. You have been warned. blob - 5342548c2ad3f0ead59be3a77d135e7d3aac61cc (mode 644) blob + /dev/null --- resources/posts/sndio-over-network.md +++ /dev/null @@ -1,51 +0,0 @@ -Like I said in the [previous entry](/post/openbsd-tethering.html) I -don't like to write _howtos_: the information tend to rot away if not -carefully updated, and I don't have all that stamina. Anyway, I felt -like writing this, and so here we are. - -Due to events that are outside the scope of this entry, I moved my -computer in a place where I cannot comfortably attach a jack to it. -(I realized this only after the rearrangement, shame on me!) - -While any sane person would have just bought a longer cable (that I -should have somewhere anyway) I decided that was the right time to -test the network capabilities of `sndio`, the audio server of my OS of -choice. - -I have to admit that while at a first glance sending audio over the -network may seem complicated, I was surprised by how easy it was. - -The plan™ was to route all the audio from my OpenBSD workstation to a -raspberry pi through the LAN. Why a raspberry? Because I had one -spare that was accumulating dust. - -So, I installed void linux on the raspberry (OpenBSD should run on the -raspberries, but for the installation you need to use the serial, and -I don't have an adapter). The setup was really quick: - -```sh -# xbps-install sndio -# xbps-install alsa-utils # for alsamixer -# echo 'OPTS="-L-"' > /etc/sv/sndiod/conf -# ln -s /etc/sv/sndiod /var/service/ -``` - -(the `-L-` is to tell `sndiod` to accept connection from anywhere.) - -And for the pi that's all. (except that I still have to increase the -volume with `alsamixer` after every boot). Now, back on the -workstation I added this to my `.xsession` - -```sh -export AUDIODEVICE=snd@192.168.1.12/0 -``` - -(You probably want to change the ip address, and only that! `snd@` -**IS NOT** a username. The same goes for the `/0`: it's the device -number, not some CIDR notation.) - -Now all the audio is transparently sent through the network to my pi, -and from there to my headphones via my (short) jack cable. Awesome. - -That's really all. Now the bad news: you could have same some time by -reading the FAQ on the OpenBSD website instead of this post :P blob - /dev/null blob + 9d63e3de165251a480bce636f997aa23a10d392d (mode 644) --- /dev/null +++ resources/posts/sndio-over-network.gmi @@ -0,0 +1,34 @@ +Like I said in the previous entry I don't like to write howtos: the information tend to rot away if not carefully updated, and I don't have all that stamina. Anyway, I felt like writing this, and so here we are. + +=> /post/openbsd-tethering.html Previous entry: Automatic USB Tethering on OpenBSD + +Due to events that are outside the scope of this entry, I moved my computer in a place where I cannot comfortably attach a jack to it. (I realized this only after the rearrangement, shame on me!) + +While any sane person would have just bought a longer cable (that I should have somewhere anyway) I decided that was the right time to test the network capabilities of sndio, the audio server of my OS of choice. + +I have to admit that while at a first glance sending audio over the network may seem complicated, I was surprised by how easy it was. + +The plan™ was to route all the audio from my OpenBSD workstation to a raspberry pi through the LAN. Why a raspberry? Because I had one spare that was accumulating dust. + +So, I installed void linux on the raspberry (OpenBSD should run on the raspberries, but for the installation you need to use the serial, and I don't have an adapter). The setup was really quick: + +``` +# xbps-install sndio +# xbps-install alsa-utils # for alsamixer +# echo 'OPTS="-L-"' > /etc/sv/sndiod/conf +# ln -s /etc/sv/sndiod /var/service/ +``` + +(the -L- is to tell sndiod to accept connection from anywhere.) + +And for the pi that's all. (except that I still have to increase the volume with alsamixer after every boot). Now, back on the workstation I added this to my .xsession + +``` +export AUDIODEVICE=snd@192.168.1.12/0 +``` + +(You probably want to change the ip address, and only that! snd@ IS NOT a username. The same goes for the /0: it's the device number, not some CIDR notation.) + +Now all the audio is transparently sent through the network to my pi, and from there to my headphones via my (short) jack cable. Awesome. + +That's really all. Now the bad news: you could have same some time by reading the FAQ on the OpenBSD website instead of this post :P blob - 2a01203f17b92927533e130419b4731553064632 blob + 18daba46264a4260909ca8124a5b31141d9e9491 --- resources/posts.edn +++ resources/posts.edn @@ -1,14 +1,21 @@ -[{:title "sndio over the network" - :slug "sndio-over-network" - :date "2020/09/22" - :tags #{:OpenBSD} - :short "why searching for a longer cable when you can use the network? /s"} - {:title "Automatic USB Tethering on OpenBSD" - :slug "openbsd-tethering" - :date "2020/09/21" - :tags #{:OpenBSD} - :short "hotplug my lazyness" - :xkcd 1319} +[{:title "Hello gemini!" + :slug "hello-gemini" + :date "2020/10/02" + :tags #{:gemini} + :gemtext? true} + {:title "sndio over the network" + :slug "sndio-over-network" + :date "2020/09/22" + :tags #{:OpenBSD} + :short "why searching for a longer cable when you can use the network? /s" + :gemtext? true} + {:title "Automatic USB Tethering on OpenBSD" + :slug "openbsd-tethering" + :date "2020/09/21" + :tags #{:OpenBSD} + :short "hotplug my lazyness" + :xkcd 1319 + :gemtext? true} {:title "EMMS" :slug "emms" :date "2020/09/20"