Skip to content

Instantly share code, notes, and snippets.

Avatar
😑
Expressionless master

m3nda erm3nda

😑
Expressionless master
  • n0n3
  • localhost
View GitHub Profile
@erm3nda
erm3nda / ww3_slide_helper.akh
Last active January 7, 2023 08:55
WW3 slide helper to continue sprinting after sliding.
View ww3_slide_helper.akh
; This modifies the behavior after slide, helps to continue sprinting after sliding.
; You can still press crouch manually while sliding to keep crouched after slide.
; You need to edit the key of slide (mine is LAlt) and maybe Space to jump ?.
; This is AutoHotkey v2 syntax
; All the close stuff is made to let Steam detect when the "game" has exit, which is the autohotkey process handle now.
~LAlt::{
If (GetKeyState("LAlt", "P") && GetKeyState("CapsLock", "P") && WinActive("ahk_exe WW3-Win64-Shipping.exe")){
Sleep 200
Send "{Space down}"
@erm3nda
erm3nda / asseto_corsa_x360_settings.txt
Last active May 25, 2022 21:32
List of x360 gamepad settings for Asseto Corsa
View asseto_corsa_x360_settings.txt
Speed Sensitivity=80%
Steering Speed=100
Gamma=2.4
Filter=0.82
Deadzone=0.23
@erm3nda
erm3nda / visitors.sh
Created May 8, 2022 08:11
Gives you accounting for unique visitors to given log file.
View visitors.sh
#!/bin/bash
# gives you accounting for unique visitors
cat $1 | cut -d" " -f1 | sort | uniq | wc -l
@erm3nda
erm3nda / userChrome.css
Created May 6, 2022 15:45
Fix Firefox window buttons decoration with css (because gtk themed)
View userChrome.css
hbox.titlebar-buttonbox {
appearance: none !important;
}
toolbarbutton.titlebar-button {
border-radius: 0px !important;
min-height: 45px !important;
}
@erm3nda
erm3nda / f4_close_windows_and_logout_kde_plasma
Created May 3, 2022 02:16
Give KDE Plasma same F4 shortcut behavior -> Close active window or gimme logout window
View f4_close_windows_and_logout_kde_plasma
#!/bin/bash
xdotool getwindowfocus getwindowname | \
grep "Plasma" && \
qdbus org.kde.ksmserver /KSMServer logout 1 0 1 || \
xdotool getwindowfocus windowclose
@erm3nda
erm3nda / thread_kill.py
Created April 17, 2022 22:04
python thread kill with ctypes
View thread_kill.py
import ctypes
def terminate_thread(thread):
"""Terminates a python thread from another thread.
:param thread: a threading.Thread instance
"""
if not thread.is_alive():
return
@erm3nda
erm3nda / compare_images.py
Created November 9, 2021 19:39
Compares images based on pixel modifications between original file (jpg,png) and converted an resized jpg from that original. Fixed RGBA problem when saving to JPEG with PIL.
View compare_images.py
import io
from PIL import Image
import numpy as np
def countDiff(img1, img2):
s = 0
if img1.size != img2.size or img1.getbands() != img2.getbands():
return -1
@erm3nda
erm3nda / ssh-persistent-tunnel.service
Created March 12, 2021 08:30
SSH permanent tunnel service
View ssh-persistent-tunnel.service
#Template SystemD service for a auto healing (reverse) SSH tunnel.
#Place this to /etc/systemd/system/ folder.
#Edit all values inside <>
#/etc/systemd/system/ssh-persistent-tunnel.service
#Edit the ports, remote user+host, and the key file.
#In the authorized_keys file on the other system, use something like this:
#<restrict,command="echo 'No Commands Allowed.'",port-forwarding,permitopen="localhost:22",permitlisten="localhost:5000">
[Unit]
Description=SSH Persistent Tunnel
@erm3nda
erm3nda / steam_launch_params_for_games_without_admin
Created January 20, 2021 04:23
Run steam game without evelevated privileges
View steam_launch_params_for_games_without_admin
; Steam launch params do not works if you don't include %command%, which represents the original launch arguments, ie: steam://rungameid/391540/
; If you remove the "" quotes and the start, you can't remove original cmd screen. That's why we use cmd + start, when cmd returns start, closes becase /C
cmd /min /C "set __COMPAT_LAYER=RunAsInvoker && start "" %command%"
@erm3nda
erm3nda / javascript_bottom_alert.js
Created October 12, 2020 14:47
Javascript code to detect when we are at bottom of the scroll
View javascript_bottom_alert.js
window.onscroll = function() {
// @var int totalPageHeight
var totalPageHeight = document.body.scrollHeight;
// @var int scrollPoint
var scrollPoint = window.scrollY + window.innerHeight;
// check if we hit the bottom of the page
if(scrollPoint >= totalPageHeight)