Skip to content

Instantly share code, notes, and snippets.

View nicka101's full-sized avatar

Nick Anstee nicka101

  • Anstee Development
  • Norway
View GitHub Profile
@nicka101
nicka101 / 2160pto1440p.py
Last active September 23, 2017 19:47
A lot of sites provide videos in 2160p and 1080p, and I like high quality, so I go for 2160p, but my monitor is only 1440p, so this script re-encodes videos down to 1440p from 2160p to save space
#!/usr/bin/env python3
# Convert 2160p to 1440p
import sys
import os
from os.path import join, getsize, dirname, basename
from subprocess import run, PIPE, STDOUT
from time import sleep
from collections import namedtuple
FFPROBE_BIN = os.getenv('FFPROBE_BINARY', 'ffprobe')
@nicka101
nicka101 / check_spare_cpu.sh
Last active February 8, 2024 12:57
Xmrig (with idle mining) via systemd and screen
#!/bin/bash
# Check the amount of CPU being consumed by processes other than xmrig
# Takes a single (optional) argument, the name of the screen to target. Defaults to "xmrig" if unspecified
set -e
#12.5% or 2 full cores (with our 16 total)
IDLE_THRESHOLD=12.5
TARGET_SCREEN="${1:-xmrig}"
NUM_CORES=$(cat /proc/cpuinfo | grep "core id" | wc -l)
@nicka101
nicka101 / patch-log4shell.yml
Last active December 18, 2021 09:03
Simple ansible playbook to patch log4j and remove JNDI lookup from discovered JARs, mitigating CVE-2021-44228. The playbook is intended for use against Debian targets (due to the use of apt and debian package names), but with minor modifications should work against other OSes.
---
- name: Patch log4shell
hosts: all
remote_user: root
tasks:
- name: Ensure find, lsof, kill, zip, unzip, coreutils and gawk are installed
apt:
name: "{{ packages }}"
state: present
vars: