Skip to content

Instantly share code, notes, and snippets.

View m0zgen's full-sized avatar

/:) m0zgen

View GitHub Profile
@m0zgen
m0zgen / nginx.minimal.conf
Created June 19, 2022 11:37 — forked from ysmood/nginx.minimal.conf
nginx minimal reverse proxy config
events {}
http {
server {
listen 8080;
server_name a.com;
location / {
proxy_pass http://127.0.0.1:8888;
}
@m0zgen
m0zgen / config
Created June 18, 2022 15:56 — forked from jzelinskie/config
generate a knot-resolver (kresd) blacklist.rpz from pihole sources
-- Refer to manual: https://knot-resolver.readthedocs.io/en/latest/daemon.html#configuration
-- Listen on all interfaces (localhost would not work in Docker)
net.listen('0.0.0.0')
net.listen('0.0.0.0', 853, {tls=true})
-- Auto-maintain root TA
trust_anchors.file = '/data/root.keys'
-- Load Useful modules
@m0zgen
m0zgen / etc-monit-monitrc.d-redis
Created May 31, 2022 12:29 — forked from tivnet/etc-monit-monitrc.d-redis
Monitoring Redis with Monit : /etc/monit/monitrc.d/redis
check host redis.host with address 127.0.0.1
if failed port 6379 protocol redis then alert
check process redis-server with pidfile "/var/run/redis/redis-server.pid"
start program = "/etc/init.d/redis-server start"
stop program = "/etc/init.d/redis-server stop"
if failed host 127.0.0.1 port 6379 then restart
if 5 restarts within 5 cycles then timeout
@m0zgen
m0zgen / README.md
Created March 15, 2022 07:48 — forked from okaufmann/README.md
Fix `warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)` error on Raspberry PI

Run the following:

echo "LC_ALL=en_US.UTF-8" | sudo tee -a /etc/environment > /dev/null
echo "en_US.UTF-8 UTF-8" | sudo tee -a /etc/locale.gen > /dev/null
echo "LANG=en_US.UTF-8" | sudo tee /etc/locale.conf > /dev/null
sudo locale-gen en_US.UTF-8
@m0zgen
m0zgen / BlockYouTubeHostsFile
Created February 9, 2022 14:18 — forked from tibovanheule/BlockYouTubeHostsFile
Block YouTube Hosts File
0.0.0.0 host.youtube.com
0.0.0.0 mx.youtube.com
0.0.0.0 admin.youtube.com
0.0.0.0 devel.youtube.com
0.0.0.0 stats.youtube.com
0.0.0.0 http.youtube.com
0.0.0.0 mx0.youtube.com
0.0.0.0 administration.youtube.com
0.0.0.0 development.youtube.com
0.0.0.0 svn.youtube.com
@m0zgen
m0zgen / chmod-400.cmd
Created October 12, 2021 10:04 — 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
If you don't have an E5 subscription, run 1709 in your environment, and use OSSEC, you can quickly add the new ASR features
to your alerting and reports since you don't have access to the Defender console thingy.
The event reference is here: https://docs.microsoft.com/en-us/windows/threat-protection/windows-defender-exploit-guard/event-views-exploit-guard#list-of-all-windows-defender-exploit-guard-events
All your need to do is add:
<localfile>
<location>Microsoft-Windows-Windows Defender/Operational</location>
<log_format>eventchannel</log_format>
@m0zgen
m0zgen / kill-all-connections-to-db.sql
Created May 13, 2021 06:40 — forked from jeffjohnson9046/kill-all-connections-to-db.sql
How to kill all connections to a Postgres database
-- Accepted answer from here: https://stackoverflow.com/questions/5408156/how-to-drop-a-postgresql-database-if-there-are-active-connections-to-it
SELECT pg_terminate_backend(pg_stat_activity.pid)
FROM pg_stat_activity
WHERE pg_stat_activity.datname = '[your database name goes here]'
AND pid <> pg_backend_pid();
# list repos
sudo apt-cache policy
# add repo
sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy universe multiverse"
# remove repo
sudo add-apt-repository --remove <ppa:whatever/ppa>