Skip to content

Instantly share code, notes, and snippets.

@nurpax
nurpax / noprofanity.c
Last active May 23, 2018 08:25
remove effings from bintris
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const char **argv)
{
FILE* fpi = fopen(argv[1], "rb");
FILE* fpo = fopen(argv[2], "wb");
@nurpax
nurpax / lfsr.c
Last active April 29, 2018 19:19
#define POLYMASK_32 0xb4bcd35c
#define POLYMASK_31 0x7a5bc2e3
#include <stdio.h>
#include <stdint.h>
uint32_t lfsr32;
uint32_t lfsr31;

Generate

prng: .byte 0,0,0,0 rngtest: lda #<prng ldx #>prng jsr rnd_seed ldy #$80 sty $61 lp1:

@nurpax
nurpax / snapshot.c
Created April 25, 2018 07:49
vice 3.1 snapshot.c copy
/*
* snapshot.c - Implementation of machine snapshot files.
*
* Written by
* Ettore Perazzoli <[email protected]>
* Marco van den Heuvel <[email protected]>
*
* This file is part of VICE, the Versatile Commodore Emulator.
* See README for copyright notice.
*
sprite0_widthmask:
// bitwidth 0
.byte 0, 0, 0, 0
// bitwidth 1
.byte %11111111, 0, 0, 0
// bitwidth 2
.byte %11111111, %11111111, 0, 0
// bitwidth 3
.byte %11111111, %11111111, %11111111, 0
// bitwidth 4
lda colora+0
sta $d020
lda colora+1
sta $d021
lda #$00
sta $d020
sta $d021
// multicolor gfx mode
//----------------------------------------------------------
.macro drawboard(screen,colorbuf) {
.const tsetbits = $62
.const tbits = $63
.const col = $64
lda #BLACK
sta col
lda #WHITE
sta col+1
// "container" for Kcal input forms (sets up formik with validation for the kcal fields).
export const KcalForm = ({ initialValues, onSubmit, render }) => {
return (
<Formik
initialValues={initialValues}
validateOnChange
validate={values => {
let errors = {}
if (values.amount === '') {
renderSaveCancel = () => {
return (
<Fragment>
<button onClick={this.handleSave}
style={{width: '50%'}}
disabled={!this.state.amount}
className='button is-primary'>
Save
</button>
<button onClick={this.handleCancel}
// Diary action creators
export class Diary {
static RECEIVE = 'DIARY_RECEIVE'
static actions = {
fetchByDate: (date) => {
return function (dispatch, getState) {
const urls = [
'/api/food',
'/api/recipe',