Skip to content

Instantly share code, notes, and snippets.

@andydude
andydude / mbr_try1.asm
Last active July 7, 2019 03:23
First attempt at a master boot record.
[bits 16]
[org 0x7C00]
start:
cli
xor si,si
mov ss,si
mov sp,0x7DBE
popa
mov es,si
bool btr(int *a, int b) {
int c = (*a >> b) & 1;
*a &= ~(1 << b);
return c;
}
@andydude
andydude / conf.c
Last active April 25, 2019 06:49
Config Reader
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
void
strvec_slurp (char **envstrvec, size_t size, size_t nitems,
const char *filename)
{
FILE *fp = fopen (filename, "r");
@andydude
andydude / prog.c
Created December 31, 2018 18:00
IOCCC 2017
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
typedef unsigned char*_;
_ s,i,z,e,O,F=
#include W
"; ; } { { { { { } { { } ; } { ; ; { } ; { { } ; } ; { { { { } { { } \
; } { { { { { } { ; } { } { { } { { } { { { ; ; { { } { { } { ; } { \
} { { { { { } ; } { } { { } { { { \
import six
import pyarrow as pa
import pandas as pd
adr_schema = pa.schema([
pa.field('pobox', pa.string()),
pa.field('street2', pa.string()),
pa.field('street1', pa.string()),
pa.field('city', pa.string()),
pa.field('state', pa.string()),
def is_alt(side, side2):
side, side2 = side[0], side2[0]
return side == side2
def is_opp(side, side2):
side, side2 = side[0], side2[0]
if ord(side) > ord(side2):
side, side2 = side2, side
if side == 'D' and side2 == 'U':
return True
<div class="panel panel-default main-panel" style="margin-bottom: 0px; height: 700px;">
<div class="panel-body">
<ul class="nav nav-tabs" role="tablist">
<li id="headers-tab" class="active"><a href="#headers" role="tab" data-toggle="tab">Headers</a></li>
<li id="cookies-tab"><a href="#cookies" role="tab" data-toggle="tab">Cookies</a></li>
<li id="params-tab"><a href="#params" role="tab" data-toggle="tab">Params</a></li>
<li id="postData-tab"><a href="#postData" role="tab" data-toggle="tab">PostData</a></li>
<li id="postText-tab"><a href="#postText" role="tab" data-toggle="tab">PostText</a></li>
<li id="response-tab"><a href="#response" role="tab" data-toggle="tab">Response</a></li>
<li id="timing-tab"><a href="#timing" role="tab" data-toggle="tab">Timing</a></li>
;; Default font
(set-default-font "unifont-16")
(custom-set-faces
;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(default ((t (
:family "unifont"
:background "White"
@andydude
andydude / wc.rs
Last active December 18, 2015 02:38
POSIX wc (word count)
extern mod extra;
use extra::getopts::*;
pub struct Total {
lines: uint,
words: uint,
chars: uint,
bytes: uint
}
@andydude
andydude / echo.rs
Last active December 17, 2015 22:38
POSIX echo
fn unwords(args: &[~str]) -> ~str {
return str::connect(args, " ");
}
fn echo(args: &[~str]) {
match args.tail() {
[~"-n", ..strs] => print(unwords(strs)),
strs => println(unwords(strs)),
}
}