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 / Instructions.txt
Last active August 28, 2020 02:40
Notes on Building the Linux kernel for Orange Pi PC2 (Allwinner H5)
Get a copy of the linux kernel source you intend to build
Install u-boot-tools, gcc-aarch64-linux-gnu, g++-aarch64-linux-gnu device-tree-compiler libncurses-dev (packages names on debian-based systems)
You also need native compiler tools available, such as build-essential
Add the following to arch/arm64/boot/dts/allwinner/Makefile:
dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb
If they allwinner folder doesn't exist, get the patches necessary to create it (and its friends) from mainline kernel, linux-sunxi, etc, etc
Add the attached dts, dtsi and defconfig files to the locations specified below:
dts & dtsi --> arch/arm64/boot/dts/allwinner/
defconfig --> arch/arm64/config/
Run the following (from the root of the kernel tree):
@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:
@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)