Skip to content

Instantly share code, notes, and snippets.

View itskenny0's full-sized avatar

kenny itskenny0

  • I don't know what I'm doing, Inc.
  • Germany
View GitHub Profile
@itskenny0
itskenny0 / dhcp2hosts.sh
Created July 8, 2024 08:27
Copy dhcp.leases to /etc/hosts on OpenWrt for AdGuard Home
#!/bin/bash
# converts /tmp/dhcp.leases to /etc/hosts format for adguardhome to show hostnames
# Paths to the files
HOSTS_FILE="/etc/hosts"
DHCP_LEASES_FILE="/tmp/dhcp.leases"
TEMP_FILE="/tmp/dhcp_hosts.tmp"
sed '/### DHCP LEASES START ###/,/### DHCP LEASES END ###/d' $HOSTS_FILE > $TEMP_FILE
mv $TEMP_FILE $HOSTS_FILE
@itskenny0
itskenny0 / deletemetric.sh
Created August 7, 2022 13:53
Delete metric in Graphite docker setup
#!/bin/bash
STAT=$1
SUB=$(echo $STAT | sed 's/\./\//g' | sed 's/$/.wsp/')
CONTAINER=$(docker ps -aq --filter name=graphite)
if [[ -z $STAT ]]; then
echo "Usage: ./deletemetric.sh stats_counters.test.metric.something"
exit 1
fi
@itskenny0
itskenny0 / README.md
Created September 22, 2021 11:18
assign touchscreen to monitor in linux

You need to replace DP-1 with your display name from xrandr, and "MTouch" with a string that shows up in your touch screen's name when executing "xinput".

@itskenny0
itskenny0 / purge.py
Created December 29, 2020 19:53
VERY crude and hastily written Python script to clean up a Telegram group using Telethon based on the user having been online within a month and a picture and username in their profile
from telethon import TelegramClient,sync
from telethon.tl.functions.contacts import ResolveUsernameRequest
from telethon.tl.functions.channels import GetAdminLogRequest
from telethon.tl.functions.channels import GetParticipantsRequest
from telethon.tl.functions.channels import EditBannedRequest
from telethon.tl.types import ChannelParticipantsSearch
from telethon.tl.types import InputChannel
from telethon.tl.types import ChannelAdminLogEventsFilter
from telethon.tl.types import InputUserSelf
from telethon.tl.types import InputUser
@itskenny0
itskenny0 / blescan2nsq.py
Last active October 8, 2020 13:21
Scans for BLE devices and publishes found devices to nsq topic.
from bluepy.btle import Scanner, DefaultDelegate
import json
import time
import gnsq
nsq = gnsq.Producer('127.0.0.1:4150')
nsq.start()
class ScanDelegate(DefaultDelegate):
def __init__(self):
@itskenny0
itskenny0 / AgeOfConan.CT
Last active January 30, 2021 14:59
AoC CE
<?xml version="1.0" encoding="utf-8"?>
<CheatTable CheatEngineTableVersion="34">
<CheatEntries>
<CheatEntry>
<ID>1</ID>
<Description>"X"</Description>
<LastState Value="851.8578491" RealAddress="2F281078"/>
<VariableType>Float</VariableType>
<Address>"AgeOfConan.exe"+0257F7C8</Address>
<Offsets>
@itskenny0
itskenny0 / cleanup.sh
Last active November 5, 2020 10:46
Cleanup script for salt minions affected by recent CVE exploitation - https://saltexploit.com - https://github.com/saltstack/salt/issues/57057
#!/bin/bash
## Executing this script is not a guarantee for a secure host!
## This script is a collection of the junk I have found on my hosts and what
## the SaltStack community gave as input. We have seen this attack evolve.
## Please have a very close look at your systems and consider reinstalling them
## to be absolutely sure you are free of malware.
# remove crontab persistence
for i in 54.36.185.99 217.8.117.137 176.31.60.91 217.12.210.192 54.36.185.99 54.36.185.99 89.223.121.139 torsocks anagima3 sa.sh$ c.sh$ selcdn.ru salt-store; do
@itskenny0
itskenny0 / ble2nsq.py
Created November 26, 2019 13:47
submit scanned BLE devices into NSQ queue in JSON format
from bluepy.btle import Scanner, DefaultDelegate
import json
import time
import gnsq
nsq = gnsq.Producer('127.0.0.1:4150')
nsq.start()
class ScanDelegate(DefaultDelegate):
def __init__(self):
@itskenny0
itskenny0 / dogfood.sh
Last active July 24, 2021 16:53
feeding the watchdog on a Raspberry Pi Zero
#!/bin/bash
exec 5>/dev/watchdog # opens file descriptor
upSeconds="$(cat /proc/uptime | grep -o '^[0-9]\+')"
while [ $(cat /proc/uptime | grep -o '^[0-9]\+') -lt 432000 ] ; do
echo "Feeding dog ..."
echo >&5
sleep 10
done
@itskenny0
itskenny0 / lp-symlink.sh
Created October 5, 2018 08:07
Find the device node (/dev/usb/lp0) for a connected line printer and symlink it to a known location