Skip to content

Instantly share code, notes, and snippets.

View mauron85's full-sized avatar

Marián Hello mauron85

View GitHub Profile
@mauron85
mauron85 / README.md
Last active October 28, 2023 03:41 — forked from maxfierke/README.md
PM2 as a Windows Service under Local Service

PM2 as a Windows Service under Local Service

This is a PoC for running PM2 as a Windows Service under the Local Service account instead of the Local System account.

Prerequsites

  • Neither pm2 or pm2-windows-service installed yet. (The Powershell script will run npm i)
    • At the very least, you should run pm2-service-uninstall before running this script
  • npm and npm-cache global folders should be somewhere accessible to NT AUTHORITY\LocalService.
@mauron85
mauron85 / dd-wrt-transparent-proxy.sh
Last active October 22, 2023 11:57
Transparent proxy for openwrt using tinyproxy & redsocks
#!/bin/sh
# https://crosp.net/blog/administration/routing-network-traffic-through-socks5-proxy-using-dd-wrt/
# https://serverfault.com/questions/200635/best-way-to-clear-all-iptables-rules
PROXIFYING_MACHINE=192.168.82.192
MACHINE_TO_PROXIFY=192.168.83.0/24
NETWORK=192.168.83.0/24
WAN_IP=192.168.81.1
iptables -I PREROUTING 1 -t mangle -s $MACHINE_TO_PROXIFY ! -d $NETWORK -p tcp -m multiport --dports 80,443 -j MARK --set-mark 3
@mauron85
mauron85 / nginx-lang.lua
Last active September 3, 2023 06:31
Detect preferred language script for Nginx written in LUA
-------------------------------------------------------------------------------
-- HTTP Accept-Language header handler --
-- @originalAuthor: f.ghibellini@gmail.com --
-- @originalRepository: https://github.com/fghibellini/nginx-http-accept-lang--
-- @modifiedBy: marian.hello@mapilary.com --
-- @gist: https://gist.github.com/mauron85/47ed1075262d9e020fe2 --
-- @license: MIT --
-- @requires: --
-- @description: --
-- returns language with greatest quality --
@mauron85
mauron85 / haiku
Last active May 8, 2023 13:28
OSX Sandbox profile for Haiku.app
#!/bin/bash
# Move Haiku.app to your profile Application folder
# so you don't accidentally run in outside sanbox
# Replace all references of /Users/finch with your username in haiku.sb!
# Always use this shell script to launch!
sandbox-exec -f ~/sandbox/haiku.sb ~/Applications/Haiku.app/Contents/MacOS/Haiku
@mauron85
mauron85 / launchvnc.sh
Last active April 6, 2023 08:12
Launch vino vnc server without configuring it first
#!/bin/bash
# This script should have been runned by user (non root)
# In case of errors like cannot open display:
# 1. Change DISPLAY=:0 for actual working display
# 2. Check (and change) permissions of files and dirs in user home dir
# specialy when you run this script as root by accident
# sometimes dirs like .dconf may be owned as root.
# As result vino server will not run under user privileges
@mauron85
mauron85 / README
Created March 3, 2018 14:11 — forked from rkusa/README
Install alpine linux on xhyve VM
# curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86_64/alpine-3.3.1-x86_64.iso
curl -LO http://wiki.alpinelinux.org/cgi-bin/dl.cgi/v3.3/releases/x86/alpine-3.3.1-x86.iso
# create hdd image (8GB)
dd if=/dev/zero of=hdd.img bs=1g count=8
# extract kernel and initramfs
brew install cdrtools
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/initramfs-grsec > initramfs-grsec
isoinfo -i alpine-3.3.1-x86.iso -J -x /boot/vmlinuz-grsec > vmlinuz-grsec
@mauron85
mauron85 / suspend-modules
Last active November 5, 2022 10:28 — forked from anonymous/suspend-modules
Ubuntu 16.04 systemd unload modules on sleep
#!/bin/bash
# Put into /lib/systemd/system-sleep/suspend-modules
# chmod a+x /lib/systemd/system-sleep/suspend-modules
# Create /etc/suspend-modules.conf
# with one module per line
# credits to:
# https://bbs.archlinux.org/viewtopic.php?pid=1540125#p1540125
@mauron85
mauron85 / recnoisered.sh
Last active March 11, 2022 15:07
How to record and filter noise from mic in Linux
# Useful links
# https://stackoverflow.com/questions/42904441/pipe-sox-play-command-to-stdout
# http://www.zoharbabin.com/how-to-do-noise-reduction-using-ffmpeg-and-sox/
# Record some noise
sox -t alsa default -b 16 -r 44100 -e signed -t wav - -t wav /tmp/noise.wav
# or alternative with arecord
@mauron85
mauron85 / imgcompare.html
Last active May 15, 2021 08:22
Sliding compare two images
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
}
@mauron85
mauron85 / letsencrypt-cert
Last active March 9, 2021 03:20
Auto refresh LetsEncrypt cert for NGINX with letsencrypt-auto
#!/bin/bash
echo "Running as user $USER"
DIR=/home/letsencrypt/letsencrypt
DOMAIN=mydomain.com
$DIR/letsencrypt-auto -a webroot --webroot-path /home/letsencrypt/webroot/ \
--config-dir /home/letsencrypt/etc \
--logs-dir /home/letsencrypt/log \