Skip to content

Instantly share code, notes, and snippets.

View mhitza's full-sized avatar

Marius Ghita mhitza

View GitHub Profile

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:

@mhitza
mhitza / backlight_timeout.md
Created November 22, 2018 21:31
Prolong keyboard backlight timeout

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.

@mhitza
mhitza / lvm_snapshots.md
Created March 24, 2016 01:39
LVM snapshots

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.
{
"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",
@mhitza
mhitza / gist:9d0e42aa5f6fa320e5cb1df6b9f46890
Created December 2, 2018 09:47
Transmission build failure
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 / vimwiki.md
Last active June 19, 2020 09:20
Using Vimwiki like a standard desktop application

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 / centos-stream.md
Last active March 4, 2021 03:33
CentOS 8 Stream on your favorite cloud provider

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 / workflow.md
Last active April 12, 2022 12:54
Faster Ansible playbook iteration with tags and Vagrant snapshots

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|
@mhitza
mhitza / main.hs
Created December 5, 2022 11:31
Day 5 advent of code 2022
{-# LANGUAGE BlockArguments, Strict #-}
import Control.Monad.State
import Data.List
import Data.Bifunctor (first)
import Data.Char
forEach xs state' f = foldM (\st v -> runState (f v) st) state' xs
@mhitza
mhitza / main.hs
Last active December 8, 2022 13:14
Day 8 advent of code 2022
{-# LANGUAGE BlockArguments, Strict #-}
import Control.Monad.State
import Data.List
import Data.Char
import Data.Bifunctor
takeUntilIncluding p [] = []
takeUntilIncluding p (x:xs)
| p x == True = x : takeUntilIncluding p xs
| otherwise = [x]