Skip to content

Instantly share code, notes, and snippets.

:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

Block or report user

Report or block luckylittle

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@luckylittle
luckylittle / replace.yml
Last active Mar 14, 2019
Closing the JSON properly in Ansible (replace last comma with curly braces)
View replace.yml
# 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 / go-builder.sh
Created Feb 26, 2019
Automatically build multi-platform, compressed binaries for Go in the current directory.
View go-builder.sh
#!/usr/bin/env bash
# MIT License
# Copyright (c) 2019 Lucian Maly, <lucian@redhat.com>
package=$1
if [[ -z "$package" ]]; then
echo "Usage: $0 <package-name-in-the-\$GOPATH/src/>"
echo "Automatically build multi-platform, compressed binaries for Go in the current directory."
echo "Example: $ $0 github.com/luckylittle/example"
echo "Requirements: \$GOPATH, go, git, zip"
@luckylittle
luckylittle / mkdir_from_filenames.sh
Created Dec 12, 2018
Creates folders based on filenames (without extensions) in the current directory
View mkdir_from_filenames.sh
#!/bin/bash
ls -1 | cut -f 1 -d '.' | xargs mkdir
View 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 / gist:5c38579f1ce23ca2ffe811b396e510be
Created Oct 11, 2018
Permanently disable automatic comment insertion in vim
View gist:5c38579f1ce23ca2ffe811b396e510be
echo '" Disable automatic comment insertion\nautocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o' | sudo tee --append /etc/vimrc
@luckylittle
luckylittle / proftpd.conf
Last active Oct 10, 2018
ProFTPd Configuration file (/etc/proftpd.conf)
View 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 / irssi.service
Created Oct 9, 2018
SystemD IRSSI service inside GNU screen (/etc/systemd/system/irssi.service)
View 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 / centos7-initialize.sh
Last active Oct 13, 2018
Bash script that downloads the most important apps that i use on my CentOS7/RHEL7 laptop
View centos7-initialize.sh
#!/bin/bash
# This is more of a notes, rather than script...
# CentOS 7 #1805 (@luckylittle)
# Majority of apps that i use on my personal CentOS laptop
# CentOS 7 #1805 based on RHEL 7.5 (ISO & VirtualBox)
# wget http://mirror.slu.cz/centos/7/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso
# wget https://cloud.centos.org/centos/7/vagrant/x86_64/images/CentOS-7-x86_64-Vagrant-1804_02.VirtualBox.box
@luckylittle
luckylittle / insertion_sort.py
Last active May 12, 2018
Insertion sort algorithm in Python
View insertion_sort.py
def insertion_sort(list):
"""
Insertion sort algorithm by @luckylittle
"""
for i in range(1, len(list)):
current = list[i]
while (i > 0) and (list[i-1] > current):
list[i] = list[i - 1]
i -= 1
@luckylittle
luckylittle / Preparing-for-a-Python-Interview.md
Last active May 11, 2018
Preparing for a Python Interview: 10 Things you should know
View Preparing-for-a-Python-Interview.md

#1 KNOW HOW TO WRITE CODE ON A WHITEBOARD/PAPER

#2 KNOW BASIC PYTHON CONTROL FLOW: controlflow.py

a)

for i in range(1,11):
  print i
You can’t perform that action at this time.