Skip to content

Instantly share code, notes, and snippets.

View luckylittle's full-sized avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / irssi.service
Created October 9, 2018 23:35
SystemD IRSSI service inside GNU screen (/etc/systemd/system/irssi.service)
[Unit]
Description=IRSSI service
[Service]
RemainAfterExit=yes
ExecStart=/usr/bin/screen -S irssi -dm irssi
ExecStop=/usr/bin/screen -S irssi -X quit
User=lmaly
[Install]
@luckylittle
luckylittle / proftpd.conf
Last active October 10, 2018 10:58
ProFTPd Configuration file (/etc/proftpd.conf)
ServerName "ProFTPD server"
ServerIdent on "FTP Server ready."
ServerAdmin root@localhost
DefaultServer on
DefaultRoot ~/Downloads
PassivePorts 49181 49189
Port 54320
DefaultAddress 0.0.0.0
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_unix.c
@luckylittle
luckylittle / gist:5c38579f1ce23ca2ffe811b396e510be
Created October 11, 2018 04:51
Permanently disable automatic comment insertion in vim
echo '" Disable automatic comment insertion\nautocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o' | sudo tee --append /etc/vimrc
@luckylittle
luckylittle / keybase.md
Created October 26, 2018 01:53
keybase.md

Keybase proof

I hereby claim:

  • I am luckylittle on github.
  • I am lmaly (https://keybase.io/lmaly) on keybase.
  • I have a public key whose fingerprint is E7D6 9540 CBDF 724E F21B 6FB9 12CD BBCD 6D90 FD00

To claim this, I am signing this object:

@luckylittle
luckylittle / mkdir_from_filenames.sh
Last active July 3, 2022 02:29
Creates folders based on filenames (without extensions) in the current directory
#!/bin/bash
ls -1 *.mkv | rev | cut -d '.' -f2- | rev | xargs mkdir -v
for i in $(ls -1 *.mkv); do mv -v ${i} ${i%.mkv}; done
# Before:
# [lmaly@localhost The_Man_in_the_High_Castle]$ ls -1 *.mkv
# The.Man.in.the.High.Castle.S01E01.720p.WEBRip.x264-BATV.mkv
# The.Man.In.The.High.Castle.S01E02.720p.WEBRip.x264-SERIOUSLY.mkv
# The.Man.In.The.High.Castle.S01E03.720p.WEBRip.x264-SERIOUSLY.mkv
@luckylittle
luckylittle / go-builder.sh
Last active December 4, 2022 02:51
Automatically build multi-platform, compressed binaries for Go in the current directory.
#!/usr/bin/env bash
# MIT License
# Copyright (c) 2020 Lucian Maly, <lucian@redhat.com>
# Raspberry Pi sometimes need more env to be built correctly, depending on the ARM version:
# `GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build` worked for my Raspberry [ARMv7 Processor rev 5 v7l]
cyan=`tput setaf 14`
beige=`tput setaf 215`
white=`tput setaf 15`
black=`tput setaf 0`
@luckylittle
luckylittle / replace.yml
Last active March 14, 2019 08:39
Closing the JSON properly in Ansible (replace last comma with curly braces)
# Sometimes there are moments, when you construct JSON in a really dirty way by just appending key/value pairs and adding comma at the end.
# You will end up with something like this:
# {
# "big_key": {
# "small_key1": "small_value1",
# "small_key2": "small_value2",
# "small_key3": "small_value3",
# And then to make this valid JSON, you need to replace the last comma with curly braces.
@luckylittle
luckylittle / YAML.md
Created June 7, 2019 03:37
YAML Multilines - Find the right syntax for your multiline strings

YAML Multiline Strings

Block scalars

Find the right syntax for your YAML multiline strings:

There are two types of formats that YAML supports for strings: block scalar and flow scalar formats. (Scalars are what YAML calls basic values like numbers or strings, as opposed to complex types like arrays or objects.) Block scalars have more control over how they are interpreted, whereas flow scalars have more limited escaping support.

  1. Block Style Indicator: The block style indicates how newlines inside the block should behave. If you would like them to be kept as newlines, use the literal style, indicated by a pipe (|). If instead you want them to be replaced by spaces, use the folded style, indicated by a right angle bracket (>). (To get a newline using the folded style, leave a blank line by putting two newlines in. Lines with extra indentation are also not folded.)
@luckylittle
luckylittle / RH342.md
Last active February 6, 2024 13:08
Red Hat RH342 Notes

Red Hat Enterprise Linux Diagnostics & Troubleshooting (RH342)

Last update: Fri Jul 26 08:23:20 UTC 2019 by @luckylittle


1. Troubleshooting principles

2. Generic issues

@luckylittle
luckylittle / listings-setup.tex
Last active July 29, 2023 06:12
LaTeX Code Listings example
% Contents of listings-setup.tex
% Example: pandoc -f markdown_github --listings -H listings-setup.tex -V geometry:margin=0.3in RH342.md -o RH342.pdf
\usepackage{xcolor}
\lstset{
basicstyle=\ttfamily,
keywordstyle=\color[rgb]{0.13,0.29,0.53}\bfseries,
stringstyle=\color[rgb]{0.31,0.60,0.02},
commentstyle=\color[rgb]{0.56,0.35,0.01}\itshape,
backgroundcolor=\color[RGB]{248,248,248},