Skip to content

Instantly share code, notes, and snippets.

View eqhmcow's full-sized avatar

Daniel S. Sterling eqhmcow

View GitHub Profile
@eqhmcow
eqhmcow / gist:a8b234ef4791769671c95c3ac7909d81
Last active July 18, 2023 00:52
build new kernel for CentOS 7
# something like this...
docker run -it oraclelinux:7
yum install rpm-build git wget vim oracle-softwarecollection-release-el7 scl-utils oraclelinux-developer-release-el7 oracle-epel-release-el7
yum-config-manager --enable ol7_software_collections
yum-config-manager --enable ol7_latest ol7_optional_latest
yum-config-manager --enable ol7_developer
git clone https://git.centos.org/rpms/kernel.git
cd kernel
@eqhmcow
eqhmcow / twitter-format.pl
Last active August 28, 2022 23:10
re-format text from e.g. rainbowstream twitter output
#!/usr/bin/perl
use strict;
use warnings;
$|++;
use Text::Format;
use IO::Select;
use Time::HiRes;
@eqhmcow
eqhmcow / tictactoe.c
Last active October 18, 2023 18:20
compute all possible tic tac toe games
#include <stdio.h>
#include <stdbool.h>
#define SIZE 9
// Winning combinations
const int WINNING_COMBINATIONS[8][3] = {
{0, 1, 2}, {3, 4, 5}, {6, 7, 8},
{0, 3, 6}, {1, 4, 7}, {2, 5, 8},
{0, 4, 8}, {2, 4, 6}
@eqhmcow
eqhmcow / cake
Last active December 16, 2020 03:15
let me eat cake
### section 1
# disable CPU mitigations, disable CPU sleep (C states), disable CPU throttling (frequency scaling)
# edit /boot/grub/grub.cfg
# mitigations=off intel_idle.max_cstate=0 processor.max_cstate=1
echo performance > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor
echo performance > /sys/devices/system/cpu/cpufreq/policy1/scaling_governor
eqhmcow@DESKTOP-DLUP89P:~/Kaleidoscope/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin$ git diff
diff --git a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp
index 1b55ed43..e788ae1d 100644
--- a/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp
+++ b/plugins/Kaleidoscope-LED-Wavepool/src/kaleidoscope/plugin/LED-Wavepool.cpp
@@ -25,6 +25,7 @@
#include "kaleidoscope/KeyAddr.h" // for MatrixAddr, KeyAddr, MatrixAddr<>::...
#include "kaleidoscope/KeyEvent.h" // for KeyEvent
+#include "kaleidoscope/LiveKeys.h" // for live_keys
@eqhmcow
eqhmcow / iptables.rules
Last active February 12, 2020 10:35
let me eat cake
# /etc/iptables.rules
# Generated by iptables-save v1.6.1 on Sat Oct 19 09:21:09 2019
*mangle
:PREROUTING ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
:MINIUPNPD - [0:0]
How to run "ls" in docker
---
Run "ls" in docker, handling various possible environmental issues that the shell normally directly handles.
That is, the below docker command is similar to simply issuing "ls" at a shell prompt, or adding an "ls" command to a shell script.
Without docker:
@eqhmcow
eqhmcow / README
Last active July 9, 2022 12:54 — forked from anonymous/README
docker wrapper
slightly-less-insecure-docker
wrapper around docker that perhaps makes it slightly less insecure
example usage:
DOCKER=/path/to/docker-wrapper
sudo $DOCKER run -it -v /etc/passwd:/etc/passwd -v /tmp:/tmp ubuntu
NOTE:
@eqhmcow
eqhmcow / aggregate.pl
Last active June 17, 2017 01:35
aggregate contiguous positive numbers
use strict;
use warnings;
my @n;
while (<>) {
push @n, $_;
}
my $first_num = 0;
my $next_num = 0;
my $contig = 0;
@eqhmcow
eqhmcow / gist:886717fc3b584118c954e9be5544dc28
Created August 19, 2016 14:10
quick and dirty linux "sysprep"
# remove IP / set IP to one that won't be used for other systems
# clear ssh host key
rm -rf /etc/ssh/ssh_host_*
# remove /etc/hosts entries as applicable
# remove utmp data - wtmp and btmp and lastlog
rm /var/log/{w,b}tmp /var/log/lastlog ;
touch /var/log/{w,b}tmp /var/log/lastlog ;