Skip to content

Instantly share code, notes, and snippets.

Avatar
😑
Expressionless master

m3nda erm3nda

😑
Expressionless master
  • n0n3
  • localhost
View GitHub Profile
@erm3nda
erm3nda / asseto_corsa_x360_settings.txt
Last active May 25, 2022
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
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
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
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 Apr 17, 2022
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 Nov 9, 2021
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 Mar 12, 2021
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 Jan 20, 2021
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 Oct 12, 2020
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)
@erm3nda
erm3nda / universal_blinking_led_arduino_example.ino
Created Aug 18, 2020
Arduino blinking led example but fixed to work also on boards with less PIN, ie attiny85 #arduino #c
View universal_blinking_led_arduino_example.ino
#include <Arduino.h>
// Attiny85 doesn't have nor recognize LED_BUILTIN 13 from Arduino.h
// Little fix to enable led blink with a LED on PIN 3 + GND to test boards.
#ifndef LED_BUILTIN
#define LED_BUILTIN 3
#endif
void setup() {
// initialize digital pin LED_BUILTIN as an output.