Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
Working for @RedHatOfficial

Lucian Maly luckylittle

:octocat:
Working for @RedHatOfficial
View GitHub Profile
@luckylittle
luckylittle / clean_logs_rhel.sh
Created Jun 20, 2022
Quickly empty all the major logs on RHEL
View clean_logs_rhel.sh
#!/bin/zsh
LOGS=(
/var/log/boot.log
/var/log/btmp
/var/log/cron
/var/log/dnf.librepo.log
/var/log/dnf.log
/var/log/dnf.rpm.log
/var/log/firewalld
@luckylittle
luckylittle / at_1640_stop_move_mouse.sh
Last active Jun 16, 2022
Move mouse for Linux Wayland (EVEMU)
View at_1640_stop_move_mouse.sh
#!/bin/zsh
at 16:40 <<END
pgrep evemu | xargs sudo kill -9
pgrep tiny_move_mouse | xargs sudo kill -9
END
@luckylittle
luckylittle / officeworks.py
Last active Jun 9, 2022
Officeworks price checker
View officeworks.py
import datetime
import smtplib
import time
import requests
import sys
import random
import json
from bs4 import BeautifulSoup
# chmod x officeworks.py
@luckylittle
luckylittle / doublecmd.xml
Last active Jun 24, 2022
Double Commander Configuration backup (/home/lmaly/.config/doublecmd/)
View doublecmd.xml
<?xml version="1.0" encoding="UTF-8"?>
<doublecmd DCVersion="1.0.6 beta" ConfigVersion="12">
<Toolbars>
<MainToolbar>
<Row>
<Separator>
<Style>False</Style>
</Separator>
<Program>
<ID>{A4794D6B-C687-4625-B17C-93D8003C8193}</ID>
@luckylittle
luckylittle / audible-last-3-manning.sh
Last active Jun 15, 2022
Script returns last three Audible products from a specific publisher
View audible-last-3-manning.sh
#!/bin/zsh
source /home/lmaly/Projects/audible-cli/venv/bin/activate
read -r -d '' -A LAST_THREE_MANNING_ASIN <<< "$(audible api /1.0/catalog/products -p publisher="Manning Publications" -p products_sort_by=-ReleaseDate -p num_results=3 | jq -r '.products[].asin')"
for ASIN in "${LAST_THREE_MANNING_ASIN[@]:0:$((${#LAST_THREE_MANNING_ASIN[@]}-1))}"
do
audible api -p response_groups=product_desc /1.0/catalog/products/${ASIN} | jq -r '.product.title'
done
#######
@luckylittle
luckylittle / predb.sh
Last active May 26, 2022
Wrapper for @crackhub-dev script predb-ovh-cli
View predb.sh
#!/bin/zsh
################
## Add alias predb='/home/lmaly/Projects/predb-ovh-cli/THIS_SCRIPT.sh'
## Usage: predb <SEARCH QUERY>
## Example: predb wild territory
################
C=''
source /home/lmaly/Projects/predb-ovh-cli/venv/bin/activate
@luckylittle
luckylittle / epub_maker.sh
Created May 24, 2022
Simple workflow to create an EPUB file from the folder and check for EPUB errors
View epub_maker.sh
#!/bin/zsh
export EPUB=Lyssa_Adkins_-_Coaching_Agile_Teams
# No compression zip file, with `mimetype` being the first file in the archive
zip -0 -X ${EPUB}.zip mimetype
zip -0 -X -r ${EPUB}.zip META-INF OEBPS
# Rename .zip to .epub
mv -v ${EPUB}.{zip,epub}
@luckylittle
luckylittle / at_1659_sleep.sh
Last active May 25, 2022
Make your computer go to sleep today at 16:59 (once)
View at_1659_sleep.sh
#!/bin/zsh
# Old way of doing it:
# at -M 16:59 <<END
# /usr/bin/sudo /bin/systemctl hybrid-sleep
# END
# New way of doing it:
# systemd-analyze calendar --iterations=5 '16:59' <-- this would run every day
# systemd-analyze calendar "$(date +%Y-%m-%d) 16:59" <-- only today
@luckylittle
luckylittle / at_1645_close_wfica.sh
Created May 19, 2022
Gracefully shut down Citrix Workspace session today at 16:45
View at_1645_close_wfica.sh
#!/bin/zsh
at 16:45 <<END
pgrep wfica | xargs kill -s TERM
END
@luckylittle
luckylittle / shutdown_at_5PM.sh
Last active May 19, 2022
Shutdown your computer at 5PM today
View shutdown_at_5PM.sh
#!/bin/zsh
sudo shutdown 17:00