Skip to content

Instantly share code, notes, and snippets.

View skynet-05's full-sized avatar
💭
Available.....just ping!

Rahul skynet-05

💭
Available.....just ping!
View GitHub Profile
@skynet-05
skynet-05 / chmod-400.cmd
Created May 4, 2023 10:10 — forked from jaskiratr/chmod-400.cmd
Set permission of file equivalent to chmod 400 on Windows.
# Source: https://stackoverflow.com/a/43317244
$path = ".\aws-ec2-key.pem"
# Reset to remove explict permissions
icacls.exe $path /reset
# Give current user explicit read-permission
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)"
# Disable inheritance and remove inherited permissions
icacls.exe $path /inheritance:r
@skynet-05
skynet-05 / python_systemd.md
Created June 14, 2021 07:10 — forked from ilyasst/python_systemd.md
Run a python script forever using systemd

Run a python script forever

In this section, we are going to show how to run a python script as a systemd service, allowing you to boot it at the start of a Linux machine and to maintain it alive.

Test method: Telegram Bot

We are going to use a very basic Telegram bot in order to test that our script will:

  1. Automatically start when the machine boot
  2. Automatically restart when it crashes/exits for whichever reason