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 / predb.sh
Last active May 26, 2022 23:40
Wrapper for @crackhub-dev script predb-ovh-cli
#!/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 02:20
Simple workflow to create an EPUB file from the folder and check for EPUB errors
#!/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 00:05
Make your computer go to sleep today at 16:59 (once)
#!/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 01:57
Gracefully shut down Citrix Workspace session today at 16:45
#!/bin/zsh
at 16:45 <<END
pgrep wfica | xargs kill -s TERM
END
@luckylittle
luckylittle / shutdown_at_5PM.sh
Last active May 19, 2022 01:55
Shutdown your computer at 5PM today
#!/bin/zsh
sudo shutdown 17:00
@luckylittle
luckylittle / sleep.sh
Last active May 19, 2022 01:56
Make your computer go to sleep immediately
#!/bin/zsh
/bin/systemctl hybrid-sleep
@luckylittle
luckylittle / informit.py
Created May 9, 2022 00:47
InformIT eBook Deal of the Day Mailinator
#!venv/bin/python3
import datetime
import smtplib
import time
import requests
import sys
import random
from bs4 import BeautifulSoup
@luckylittle
luckylittle / playbook.yaml
Last active April 7, 2022 05:34
Elegant way to append to a JSON file
---
# Example of constructing & appending to a JSON file
# Required JSON payload:
#
# [
# {
# "id": "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa",
# "type": "host"
# },
@luckylittle
luckylittle / example_extension.sh
Created January 27, 2022 21:43
Example of the command that is useful for processes that change file extension and also have spaces in the filename
find . type f -name '*.original_extension' -execdir /bin/zsh -c '/usr/bin/echo $0 ${0/original_extension/new_extension}' {} \;
######################################################################
## Before: ./01-Part 1.original_extension ##
## After: ./01-Part 1.original_extension ./01-Part 1.new_extension ##
######################################################################
@luckylittle
luckylittle / argocd.sh
Last active December 9, 2021 10:26
Codefresh GitOps Certification
#!/bin/zsh
argocd app create controller \
--project default \
--sync-policy automatic \
--repo https://github.com/codefresh-contrib/gitops-certification-examples \
--path ./secret-app/manifests \
--dest-server https://kubernetes.default.svc \
--dest-namespace kube-system