Skip to content

Instantly share code, notes, and snippets.

Avatar

Marius Ghita mhitza

View GitHub Profile
@mhitza
mhitza / centos-stream.md
Last active Mar 4, 2021
CentOS 8 Stream on your favorite cloud provider
View centos-stream.md

Q2 is closing in for the first release of [Rocky Linux][1], but until that rolls around I think it might be a good time to give CentOS Stream a try.

While I'm probably one of those users who will jump ship once Rocky Linux hits the shelves, so to speak, 2021 might not necessarily be the moment I make the switch. I'm not going to rant about RedHat's current track record; I will say that I somehow managed to trip on a couple of differences between RedHat 8 and CentOS 8. Which should even exist in the first place. Hopefully, the same issues aren't going to resurface with Rocky Linux. With the amount of Ansible roles I depend on daily, I'll wait things out a bit to stabilize first.

@mhitza
mhitza / vim-guile.md
Last active Sep 20, 2021
vim + GNU Guile development environment
View vim-guile.md

This document was based on my local [GNU Guile][1]-3.0.5 setup. I'm not sure if it works as is with an older version of GNU Guile.

Because of a [dependency in Fedora][2] I had to compile GNU Guile from source release. As such, in your local setup the paths will differ. This is only relevant when defining the GUILE shell variable, and referencing the tags file in the vimrc.

Note that when building GNU Guile from source be sure that you have the readline-devel (or distro equivalent package) installed. That way the ./configure step will pick that up, and the ice-9 readline module will be usable.

@mhitza
mhitza / vimwiki.md
Last active Jun 19, 2020
Using Vimwiki like a standard desktop application
View vimwiki.md

I've started using [Vimwiki][0] recently, mostly for note keeping, and this post is about how I integrated it into my workflow.

The main feature I use from Vimwiki is the Diary. And the way I've used past note taking applications were always in short bursts.

  1. Have an idea
  2. Launch the note-taking application
  3. Type in note
  4. Quit application.
@mhitza
mhitza / workflow.md
Last active Aug 30, 2021
Faster Ansible playbook iteration with tags and Vagrant snapshots
View workflow.md

In the last few months, I had to write multiple Ansible playbooks, to the point that the slow write/test cycle became a major annoyance. What seemed to work well for me was a mix between Ansible tags and Vagrant snapshots. I would be happy to hear what workflow others employ, that specifically minimizes the time they spend testing.

Setup

Vagrantfile

Vagrant.configure("2") do |config|
View .stylelintrc.json
{
"rules": {
"indentation": 4,
"block-opening-brace-space-before": "always",
"block-closing-brace-newline-before": "always",
"block-opening-brace-newline-after": "always",
"selector-list-comma-newline-after": "always",
View gist:9d0e42aa5f6fa320e5cb1df6b9f46890
libtool: compile: gcc -DHAVE_CONFIG_H -I. -I./compat -I./include -I./include -g -O2 -Wall -fno-strict-aliasing -pthread -MT bufferevent_openssl.lo -MD -MP -MF .deps/bufferevent_openssl.Tpo -c bufferevent_openssl.c -o bufferevent_openssl.o
bufferevent_openssl.c: In function ‘bio_bufferevent_new’:
bufferevent_openssl.c:106:3: error: dereferencing pointer to incomplete type ‘BIO’ {aka ‘struct bio_st’}
b->init = 0;
^~
bufferevent_openssl.c: At top level:
bufferevent_openssl.c:228:1: error: variable ‘methods_bufferevent’ has initializer but incomplete type
static BIO_METHOD methods_bufferevent = {
^~~~~~
bufferevent_openssl.c:79:27: warning: excess elements in struct initializer
@mhitza
mhitza / backlight_timeout.md
Created Nov 22, 2018
Prolong keyboard backlight timeout
View backlight_timeout.md

I have a Dell Inspiron 5570 (5000 series) and for some obscure reason in my default linux instalation the default keyboard backlight timeout is something like 1 second. Doesn't make any sense, what benefit does a keyboard backlight have if I can only see it in the dark only when I'm already typing?

Took a couple of wrong paths searching for a solution until I found how to manually tweak that value. Keyboard backlights configuration files are located under /sys/class/leds and for a Dell laptop the magic file is /sys/class/leds/dell::kbd_backlight/stop_timeout.

There's no option to disable the timeout completely so I've created a systemd service that sets the timeout to 30 minutes (just an arbitrary large value) each time graphical.target is reached.

View keybase.md

Keybase proof

I hereby claim:

  • I am mhitza on github.
  • I am mhitza (https://keybase.io/mhitza) on keybase.
  • I have a public key whose fingerprint is E096 835D F783 5B79 8CFD 7DC3 EA9C C2E8 C590 119A

To claim this, I am signing this object:

View lvm_snapshots.md

LVM snapshots are logical volumes that reflect the state of the snapshoted volume at the exact moment in time the snapshot was created. Useful for backups and reference points we can revert back to.

Creating snapshots

$ sudo lvcreate --size 5G --snapshot --name root-backup /dev/vg0/root
  Logical volume "root-backup" created.
@mhitza
mhitza / Makefile
Last active Sep 29, 2021
Programming Arduino Uno (ATmega386P) in assembly
View Makefile
%.hex: %.asm
avra -fI $<
rm *.eep.hex *.obj *.cof
all: $(patsubst %.asm,%.hex,$(wildcard *.asm))
upload: ${program}.hex
avrdude -c arduino -p m328p -P /dev/arduino-uno -b 115200 -U flash:w:$<
monitor: