Skip to content

Instantly share code, notes, and snippets.

View willnaoosmith's full-sized avatar
🐧
Torvalds take the wheel 🙏🏻

William Brochensque Júnior willnaoosmith

🐧
Torvalds take the wheel 🙏🏻
View GitHub Profile
@willnaoosmith
willnaoosmith / gist:5cdd128e3bf229fd46f7850f2b85aecc
Created July 5, 2023 12:56
Change all commits to the github Actions bot
git filter-branch -f --env-filter "
GIT_AUTHOR_NAME='Github Actions'
GIT_AUTHOR_EMAIL='41898282+github-actions[bot]@users.noreply.github.com'
GIT_COMMITTER_NAME='Github Actions'
GIT_COMMITTER_EMAIL='41898282+github-actions[bot]@users.noreply.github.com'
" HEAD
git push origin master --force
@willnaoosmith
willnaoosmith / fontVizualizer.py
Created July 4, 2023 19:18
PyQt5 font Vizualizer
import sys
import textwrap
from PyQt5.QtWidgets import *
from PyQt5 import QtWidgets, QtGui, QtCore
from PyQt5.QtWidgets import QTextEdit
from PyQt5.QtGui import *
from PyQt5.QtCore import *
@willnaoosmith
willnaoosmith / gist:96a0b23abe3a4815f237f157a69aa80c
Created July 3, 2023 11:07
get live history of a specified cron service
alias cronhis='tail -n 999 -f /var/log/syslog | cut -d " " -f 1-4,7,9- | grep -i $1'
@willnaoosmith
willnaoosmith / gist:53374ffedd36b8893137217a19b82bc8
Created June 28, 2023 17:02
check if port is open on a host
nc -zv host port
@willnaoosmith
willnaoosmith / gist:0769843b8532b7b0f1e40b7039115757
Created June 21, 2023 11:28
Show how many times a systemd service restarted
systemctl show yourServiceHere.service -p NRestarts
journalctl -u yourServiceHere.service | grep -i start
@willnaoosmith
willnaoosmith / gist:517056e1d1814e30878e503150dfb980
Created June 20, 2023 12:19
Install python 3.11 on debian
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev
wget https://www.python.org/ftp/python/3.11.1/Python-3.11.1.tgz
tar -xvf Python-3.11.1.tgz
cd Python-3.11.1
sudo ./configure --enable-optimizations
sudo make -j 2
sudo make altinstall
sudo apt install -y python3-pip
cd ..
rm -rf Python-3.11.1 Python-3.11.1.tgz
#thread.py file:
import threading
class thread(threading.Thread):
def __init__(self, function=None, sleep=1):
super().__init__()
self._kill = threading.Event()
self._function = function
self.interval = sleep
@willnaoosmith
willnaoosmith / gist:e3b4d01a169c07a42fbbd614e4ae60c7
Created May 25, 2023 18:10
find first ocrrence of item in list where something is something, or return none
next((x for x in list if x == y), None)
On server:
sudo wget -O /usr/local/bin/rsub https://raw.github.com/aurora/rmate/master/rmate && sudo chmod +x /usr/local/bin/rsub
Locally:
run: nano ~/.ssh/config
and paste:
Host HostHere
@willnaoosmith
willnaoosmith / Logging.py
Last active May 24, 2023 19:47
Logging function file with colors
from colorist import Color, BrightColor, BgColor, Effect
from sys import stdout, stderr
from datetime import datetime
def success(message):
stdout.write(f"{datetime.now().strftime('%d/%m/%Y, %H:%M:%S')} - {Color.GREEN}[SUCCESS]{Color.OFF}: {message}\n")
def info(message):
stdout.write(f"{datetime.now().strftime('%d/%m/%Y, %H:%M:%S')} - {Color.CYAN}[INFO]{Color.OFF}: {message}\n")