Skip to content

Instantly share code, notes, and snippets.

View ImanolFotia's full-sized avatar
🎯
Focusing

Imanol Fotia ImanolFotia

🎯
Focusing
View GitHub Profile
@ImanolFotia
ImanolFotia / KALI_ASUS_T100.md
Last active April 2, 2024 18:49
Installing Kali Linux on Asus T-100 Transformer laptops (Apr-2024)

Setup

After installing Kali, the installer will fail to install the bootloader.
Continue without installing it, it will give a way to boot from grub-rescue, but in my experience it will pretty much always fail.
Prepare a USB stick with a live Linux image, in my case I used Mint, but any other should be fine.

You should have created at least a 100MB (minimum) EFI partition and the root ext4 partition.
Since these laptops come with only 2GB of RAM, a 1GB swap partition is also recommended.

Keep in mind that the partition order matters, the EFI partition should be at the beginning of the drive.

@ImanolFotia
ImanolFotia / ECS.cpp
Last active July 8, 2020 03:51
Barebones ECS implementation
#include <memory>
#include <vector>
#include <iostream>
#include <unordered_map>
#include <type_traits>
#include <stdexcept>
class Scene;
class Entity {
@ImanolFotia
ImanolFotia / InterruptHandler.asm
Last active August 19, 2019 03:16
While playing the game TIS-100, I wondered how the code I created for the interrupt handler puzzle would translate to x86 assembly (x86 code on the left and equivalent TIS-100 assembly on the right as comments)
.L32: ;.START
movzx eax, WORD PTR [rbp-42] ;//////////////
mov WORD PTR acc[rip], ax ;MOV UP, ACC
movzx eax, WORD PTR acc[rip] ;//////////////
test ax, ax ;//////////////
jne .L28 ;JEZ .EZ
;.EZ:
#include <thread>
#include <queue>
#include <functional>
#include <future>
#include <map>
#include <algorithm> // for std::min
#include <iostream>
#include <memory>
#include <mutex>
#include <string>
In this file I will list things that are not in most documentations you find online, these oversights will lead to hours of innecesary debugging.
  • Before start implementing the opcodes, check that your fetch_opcode() function is giving you the right opcode.
  • Initialize your PC with 0x200

Possible opcode oversights:

  • 0x00E0 - CLS: If you don't refresh your image every cpu cycle, set your redraw texture to true when calling this function
  • 0x00EE - RET: Increase your Program counter after this call, or you will get infinite loops
  • 0xB000 - JP : Dont increment the program counter after any jump
  • 0x8004 - ADD: Check for carry before adding
#pragma once
#include <glm/glm.hpp>
//Check out https://developer.valvesoftware.com/wiki/Source_BSP_File_Format for further reference
// little-endian "VBSP" 0x50534256
#define IDBSPHEADER (('P' << 24) + ('S' << 16) + ('B' << 8) + 'V')
#define LZMA_ID (('A' << 24) | ('M' << 16) | ('Z' << 8) | ('L'))
#define HEADER_LUMPS 64
#define MAX_MAP_VISIBILITY 0x1000000
/*
* SimpleJSON is a lightweight, header only JSON parsing library for C++
* It was created for the purpose of having a very simple parser for small/test projects
* If you need pure JSON standard compliance and a robust implementation this is not for you
* Please check https://www.json.org/ for mature alternatives
*
* THIS IS A WORK IN PROGRESS, DON'T REPORT BUGS YET
* IT DOESN'T EVEN COMPILES
*
* Copyright 2018 Imanol Fotia
@ImanolFotia
ImanolFotia / DHCP_bomb.cpp
Created May 10, 2017 16:47
Pretty old code that I wrote a long time ago, it may not compile right off the bat
#include <iostream>
#include <memory>
#include <cstdlib>
#include <exception>
#include <cstring>
#ifdef __linux__
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <netinet/ip.h>
@ImanolFotia
ImanolFotia / Caesar_Cipher.cpp
Last active April 22, 2017 03:15
When I'm bored
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
string str = "MrcSZJboRetnFdgAQHLEBpPvDImkuxYCNflOhWjViqaUywzXsTKG";
constexpr std::size_t mod = 52;
char Cipher(char c, int key)
#include <iostream>
#include <memory>
#include <cstdlib>
#include <exception>
#ifdef __linux__
#include <netinet/tcp.h>
#include <netinet/ip.h>
#else
#error This program must be compiled using Linux