Skip to content

Instantly share code, notes, and snippets.

View pr0way's full-sized avatar
🎯
Focusing

Tpk pr0way

🎯
Focusing
View GitHub Profile
@pr0way
pr0way / README.md
Last active August 17, 2023 22:31
Simple bash script to make mysql backup via docker

Attention

This wrapper use hardcoded data, you should avoid this. This doesn't meet best practices writing bash scripts but I leave this as it is because I use other methods to secure it.

My first recommendation is add separate mysql (read only) user for this purpose. It dramatically reduce possibly attack surface.

You can do this easily log in as root in your mysql instance and run:

Locally:
mysql -u root -p
@pr0way
pr0way / README.md
Last active July 22, 2022 16:35
Hama Radio DIR355BT management script

Simple Hama DIR355BT management script.

I run it from my NAS server as cron job every day to turn on my radio when I go into the kitchen and turn off when I go out to work.

Before use

Make this file executable:

chmod +x hama_dir355bt.sh

Use:

@pr0way
pr0way / HiddenAccount.ps1
Last active June 20, 2021 17:50
Script to create hidden user(s) to connect via remote desktop (local admin)
function Test-IsAdmin {
([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
}
if(!(Test-IsAdmin)){
Write-Warning "Try again, run with administrator privileges."
Exit
}
$Username = Read-Host -Prompt "Enter username"
@pr0way
pr0way / music_library.py
Created September 13, 2020 11:54
Simple script that make a file with list of files in directory and save them into file.
from os import path, scandir
print("Pass path to the directory: ")
mypath = path.join(input())
filename = path.basename(mypath).lower() + '-tracklist.txt'
with scandir(mypath) as it:
list_of_files = [entry.name for entry in it if entry.is_file()]
@pr0way
pr0way / README.md
Last active January 31, 2024 09:49
Simple init script to up & down wireguard
  1. Go to /etc/init.d directory
  2. Create file with name "wireguard" and content below.
  3. Make file executable chmod +x wireguard
  4. Add to rc-update: rc-update add wireguard default
  5. That's it
@pr0way
pr0way / Readme.md
Last active December 27, 2019 17:17
Simple removeDuplicate script

How to use?

Simple copy/paste code or download/extract and:

  1. Permit to execute chmod +x removeDumplicate.py

  2. Use: ./removeDuplicate.py <source-file> <target-file>

Parameters Required Description
`` Yes Your file which you want to modify
@pr0way
pr0way / pagekit.local
Created May 14, 2019 14:51
Pagekit config file for nginx servers (working ~ PHP 7.2-FPM)
server {
# Server name
server_name pagekit.local www.pagekit.local;
error_log /var/log/nginx/pagekit.local.error error;
access_log /var/log/nginx/pagekit.local.access;
# Server Port
listen 80;
@pr0way
pr0way / randomize.py
Last active March 3, 2019 00:51
Simple script to shake your file context :)
#! /usr/bin/env python
import sys
from random import sample
class File:
# Open file
def __init__(self, name, mode='r+'):
self.name = name
@pr0way
pr0way / nginx.file
Created November 23, 2018 17:41
Simple temporary solution for disappear nginx logs folder
# Add these lines at the end your /etc/rc.local before `exit 0`
if [ ! -d /var/log/nginx ]; then
sudo mkdir -p /var/log/nginx
fi
@pr0way
pr0way / docker.sh
Created November 18, 2018 19:30
Docker cheat
sudo docker container ls # show running container
sudo docker container ls -a # show all container
sudo docker container rm $(sudo docker container ls -aq) # remove all container
sudo docker images # show all images
sudo docker image rm $(sudo docker image ls -q) # remove all images