Skip to content

Instantly share code, notes, and snippets.

@pikhq
pikhq / chip8-disas.c
Created April 20, 2013 04:51
A quick Chip8 disassembler using Octo mnemonics.
#include <stdint.h>
#include <stdio.h>
int main()
{
int addr = 0x200;
while(!feof(stdin)) {
uint16_t opcode = (unsigned char)getchar() << 8;
opcode |= (unsigned char)getchar();
if(feof(stdin)) { break; }
#define _XOPEN_SOURCE 700
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/wait.h>
#include <netinet/in.h>
#include <netdb.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
@pikhq
pikhq / http_client.c
Created May 21, 2015 02:28
Naive http client -- does SSL, and does not much else.
#define _POSIX_C_SOURCE 200809L
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <string.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <netinet/in.h>
@pikhq
pikhq / detect-title.c
Last active May 2, 2021 17:52
Small util to detect if a terminal does or does not support terminal titles.
/* Copyright © 2015 Ada Worcester <oss@ada.pihq.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
/* Copyright (c) 2016 Ada Worcester <ada@oss.pikhq.com>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
@pikhq
pikhq / keybase.md
Created November 5, 2022 23:53
Keybase proving

Keybase proof

I hereby claim:

  • I am pikhq on github.
  • I am pikhq (https://keybase.io/pikhq) on keybase.
  • I have a public key ASB1pzAGBTjRoHuBg80KERl-i0fGckiJHBeJ0ziD_Fq92wo

To claim this, I am signing this object: