Skip to content

Instantly share code, notes, and snippets.

View wmealing's full-sized avatar
💭
Take me home, country roads

Wade Mealing wmealing

💭
Take me home, country roads
  • Brisbane
View GitHub Profile
@wmealing
wmealing / C-states.md
Last active March 29, 2024 22:51
What are CPU "C-states" and how to disable them if needed?

To limit a CPU to a certain C-state, you can pass the processor.max_cstate=X option in the kernel line of /boot/grub/grub.conf.

Here we limit the system to only C-State 1:

    kernel /vmlinuz-2.6.18-371.1.2.el5 ... processor.max_cstate=1

On some systems, the kernel can override the BIOS setting, and the parameter intel_idle.max_cstate=0 may be required to ensure sleep states are not entered:

| PIN | | Description |
|-----+---------+---------------------+
| 01 | Shield | |
| 02 | | |
| 03 | | |
| 04 | GRND | |
| 05 | 16V | Supply (for dock ?) |
| 06 | 16V | |
| 07 | 16V | |
| 08 | 5V | Supply for usb ? |
@wmealing
wmealing / ANSI.md
Created September 4, 2022 04:02 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@wmealing
wmealing / nmi-interrupts.txt
Created May 6, 2013 03:45
NMI interrupts and the joy they bring.
A non-maskable interrupt (NMI) is an interrupt type which differs from standard interrupt mechanism by enforcing attention from the interrupt processor (usually the CPU). This solution discusses an NMI is in more depth and how they are handled.
### What is an Interrupt ? ###
Modern systems architecture has created tightly coupled connect between system components. Work for components can be handed off to a component for completion. Rather than wait for the component the main CPU can be tasked to do other pending work.
When the component has completed its work it will raise a signal to the main processor. The main processor considers this signal an "interrupt", as the current work on the CPU will be interrupted immediately Each component has a number assigned to it.
### Why "mask" an interrupt ? ###
mode "passthrough" {
bindsym Mod1+Alt_L mode "default"
}
bindsym Mod1+Alt_L mode "passthrough"
var dbits, canary = 244837814094590, j_lm = 15715070 == (canary & 16777215);
function BigInteger(a, b, c) {
null != a && ("number" == typeof a ? this.fromNumber(a, b, c) : null == b && "string" != typeof a ? this.fromString(a, 256) : this.fromString(a, b));
}
function nbi() {
return new BigInteger(null);
}
function am1(a, b, c, d, e, f) {
for (; 0 <= --f;) {
var h = b * this[a++] + c[d] + e;

Sony Bravia HTTP API

The sony bravia has a HTTP API interacted with using a Pre-Shared key. There's a more complex auth flow but I've not described it here.

There wasn't any documentation, so I've written some. If you're a TV integrator don't read this, you'll laugh. I'm probably just getting confused by UPnP.

Disclaimer: I've only tested this on my TV, which is a KDL-50W829B. Your TV might not have all of the services; see Available services section for how to discover what your TV supports.

@wmealing
wmealing / gist:2a1a724b267cdde1a2727d8c7a5cb0f4
Created October 9, 2020 07:20
this should be crashing on tsx disabled systems.
#include <stdio.h>
int main()
{
int x = 0;
while (x < 100000) {
asm ("xbegin ABORT");
x++;
asm ("xend");
asm ("ABORT:");
Validating TPM PCRS on Red Hat Enterprise Linux.
Most modern systems have a TPM implemented in hardware of the system that is frequently used as a method to ensure platform integrity of system level components.
TPM status is communicated with the operating system through “Trusted Platform Configuration Register (PCR) settings. The TPM has several different PCR which are used for different, specific purposes. Some of these registers are intended to be used as hardware and software validation methods to ensure that an “Evil maid” attack has not taken place between boots.
Some attacks may modify the boot process to gain additional privileges while the system is running.
Option 1 : LUKS decryption on PCRS validation.
@wmealing
wmealing / dmesg out
Created May 27, 2020 14:11
the dmesg output when the debug is enabled and the A1 button is pressed.
[ 2019.252809] exresolv-0084 ex_resolve_to_value : Resolved object 00000000ee340dd7
[ 2019.252873] exresolv-0138 ex_resolve_object_to_v: [Arg/Local 0] ValueObj is 00000000ee340dd7
[ 2019.252891] exresolv-0084 ex_resolve_to_value : Resolved object 00000000ee340dd7
[ 2019.252937] exresop-0126 ex_resolve_operands : Opcode 70 [Store] RequiredOperandTypes=000002F2
[ 2019.252952] exresop-0210 ex_resolve_operands : Operand is a Reference, Class [Local] 00
[ 2019.252966] exresop-0210 ex_resolve_operands : Operand is a Reference, Class [Argument] 01
[ 2019.252980] exresolv-0138 ex_resolve_object_to_v: [Arg/Local 0] ValueObj is 00000000ee340dd7
[ 2019.252995] exresolv-0084 ex_resolve_to_value : Resolved object 00000000ee340dd7
[ 2019.253008] exdump-0880 ex_dump_operands : **** Start operand dump for opcode [Store], 2 operands
[ 2019.253021] exdump-0625 ex_dump_operand : 00000000ee340dd7 Refs=3 Integer 0000000000000085