Skip to content

Instantly share code, notes, and snippets.

View hypothermic's full-sized avatar

hypothermic hypothermic

View GitHub Profile
@hypothermic
hypothermic / Android ExifInterface all attributes
Created November 16, 2018 17:52
A string array of all the EXIF attributes from ExifInterface. (Android)
/*java.lang.reflect.Field[] fields = ExifInterface.class.getDeclaredFields();
ArrayList<String> exifs = new ArrayList<>();
for (java.lang.reflect.Field field : fields) {
if (java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.getType() == String.class) {
try {
System.out.println("\"" + field.get(null) + "\",");
} catch (IllegalAccessException e) {
//e.printStackTrace();
}
}
@hypothermic
hypothermic / build.gradle
Created May 1, 2019 15:51
IntelliJ IDEA Gradle Java Swing form compilation (build.gradle)
apply plugin: 'java'
apply plugin: 'application'
group 'nl.hypothermic'
version '7.1.90144-RELEASE'
mainClassName = 'nl.hypothermic.xanalyzer.modules.md-main.Main'
sourceCompatibility = 1.7
@hypothermic
hypothermic / virtualbox-resize-fixed-vdi-disk.sh
Created September 6, 2019 09:25
Virtualbox resize fixed VDI disk
# copy hdd, the result will be a dynamic hdd.
VBoxManage clonehd ./osdisk.vdi ./osdisk-copy.vdi
# resize it (to 25GB in this case)
VBoxManage modifyhd ./osdisk-copy.vdi --resize 25000
@hypothermic
hypothermic / everything_wrong_with_php.md
Last active November 12, 2019 18:50
Everything wrong with PHP

Everything wrong with PHP

  • In object-oriented programming, constructors aren't functions. But in PHP they are declared using function __construct. Weird.
  • No annotations/attributes! How are we supposed to provide metadata about class members?! (and no, phpdoc isn't an annotation, fuck off.)
  • Namespace separators are a backslash, which means they have to be escaped in JSON and other languages.
  • Why do constructors start with __? I've never used this key on my keyboard before.
  • No strict type enforcement / non-null types.
  • No casting to arrays, or specific types.
  • No typed variables within method signatures.
  • No mixed varargs.
@hypothermic
hypothermic / arch_server.md
Last active September 10, 2020 22:40
Arch server installation

Arch server installation

Archlinux is perfect for minimal servers because it does not come with bloatware programs like other OSes (ex. centos, rhel, deb, etc) do and therefore reduces the potential attack surface. One of the biggest benefits due to Arch's rolling release cycle is that you will get security updates within hours, instead of days to months if you're using ubuntu, centos, etc. However, it must be configured in a right manner and great care must be taken on every action.

Installation guide

  1. Boot into Live ISO and switch to root user (su) if not already using
  2. Create root and swap partitions on disk you want to use.
@hypothermic
hypothermic / main.s
Created September 15, 2020 19:15
Tekkit Classic server prototype in 64bit asm for linux 2.7+
/**
* Tekkit Classic / Minecraft 1.3- server prototype
* in x86_64 assembly (nasm syntax) using linux syscalls.
* I've bundled this into a single file to make it easy to use.
* Only works on LE currently.
*
* hypothermic, 15-09-2020
*/
/*
* See included Makefile or compile using following commands:
:: https://blog.prowling.nu/2012/09/modifying-kvm-qemu-kvm-settings-for.html
:: Updated for WinX by hypothermic
@reg copy HKLM\HARDWARE\ACPI\DSDT\BXPC HKLM\HARDWARE\ACPI\DSDT\WOOT /s /f
@reg delete HKLM\HARDWARE\ACPI\DSDT\BXPC /f
@reg copy HKLM\HARDWARE\ACPI\DSDT\WOOT\BXDSDT HKLM\HARDWARE\ACPI\DSDT\WOOT\WOOT /s /f
@reg delete HKLM\HARDWARE\ACPI\DSDT\WOOT\BXDSDT /f
@hypothermic
hypothermic / autoexec.cfg
Last active November 9, 2021 00:17
CSGO autoexec.cfg - 400 dpi sens ===== LAUNCH SETTINGS: +exec autoexec.cfg -tickrate 128 -novid -high -threads 6 -w 1280 -h 960 -language Dutch -console -freq 74
sensitivity 2.4
m_yaw 0.0165
rate "786432"
fps_max "0"
cl_cmdrate "128"
cl_updaterate "128"
bind 4 "use weapon_c4"
bind q "use weapon_flashbang"

Keybase proof

I hereby claim:

  • I am hypothermic on github.
  • I am hypothermic (https://keybase.io/hypothermic) on keybase.
  • I have a public key whose fingerprint is 2E23 7E9D 9ADB 1B88 505B 3488 B052 6642 ACBE 5FB0

To claim this, I am signing this object:

@hypothermic
hypothermic / valgrind-gdb-debugging.md
Created March 1, 2022 10:38
Example of valgrind + vgdb + gdb debugging to find uninitialized memory segments

Introduction

It took me two hours to find out that I hadn't properly initialized a dynamic array that was allocated on the stack. Valgrind is truly an awesome tool, and in conjuction with GDB it is really powerful. I will have probably forgotten how to use Valgrind in a week from now, so that's why I'm writing this quick summary on how I managed to debug the issue. I hope it's useful for future reference.

1. Running the program