Skip to content

Instantly share code, notes, and snippets.

View tavy315's full-sized avatar
🎯
Focusing

Octav tavy315

🎯
Focusing
View GitHub Profile
@tavy315
tavy315 / build-blog.yml
Created February 6, 2022 18:50 — forked from radupotop/build-blog.yml
.github/workflows/build-blog.yml
# .github/workflows/build-blog.yml
#
name: Build & Publish blog
on:
push:
branches: [ master ]
jobs:
build-blog:
@tavy315
tavy315 / MugAlertCommand.php
Created December 13, 2020 20:25 — forked from 94noni/MugAlertCommand.php
MugAlertCommand.php
<?php
namespace App\Command;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\DomCrawler\Crawler;
use Symfony\Component\Mailer\MailerInterface;
@tavy315
tavy315 / check.bash
Created November 6, 2020 15:37
validate PDF files using pdfcpu (https://github.com/pdfcpu/pdfcpu)
#!/bin/bash
find . -name "*.pdf" -print0 | while read -d $'\0' file
do
/usr/bin/pdfcpu validate -q "$file" &> /dev/null
if [ $? == "1" ]; then
((if++))
echo "$if) $file PDF file is invalid."
else
@tavy315
tavy315 / centos8.bash
Last active February 6, 2020 20:36
CentOS Utils
# PICO
yum -y install nano
ln -s /usr/bin/nano /usr/bin/pico
export EDITOR="pico"
# NTP
dnf install chrony
systemctl start chronyd
systemctl status chronyd
systemctl enable chronyd
@tavy315
tavy315 / mysql
Last active April 10, 2019 07:45
Create a database and a username with permission on DB
CREATE DATABASE db_name;
CREATE USER 'db_name'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
GRANT ALL ON db_name.* TO 'db_user'@'localhost';
FLUSH PRIVILEGES;
@tavy315
tavy315 / apache-hackers.conf
Created February 20, 2018 16:54
Fail2ban filter to ban a list of ips accessing vulnerable scripts
# HOW TO APPLY THIS RULE: JAIL.LOCAL
#
# make sure to use a smaller name, so you don't exceed the limit
#
# [apache-hackers]
# enabled = true
# port = http,https
# filter = apache-hackers
# banaction = iptables-allports
# logpath = /var/log/apache*/*access*.log
@tavy315
tavy315 / firewall.bash
Created November 2, 2017 12:59
Allow specific IP to access port 22 and block access for everyone else
iptables -F
iptables -A INPUT -p tcp --dport 22 -s 192.168.0.1 -j ACCEPT -m comment --comment "office.i2ct.com"
iptables -A INPUT -p tcp --dport 22 -j DROP
iptables -L -n
@tavy315
tavy315 / test.php
Created October 5, 2017 12:32
Testing inexisting index
<?php
$a = [
'b' => [
'c' => [
'd' => 'test',
],
],
];
var_dump($a['b']['c']['d']);
@tavy315
tavy315 / crontabs.bash
Created September 25, 2017 13:15
This script will loop over each user name listing out their crontab
#!/bin/bash
for user in $(cut -f1 -d: /etc/passwd); do echo $user; crontab -u $user -l; done