Skip to content

Instantly share code, notes, and snippets.

const SerialPort = require('serialport');
const fs = require('fs');
//request reset on address /?9999999
let request_init = [ 0x2f, 0x3f, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x39, 0x21, 0x0d, 0x0a ];
//select register "51"
let request_select_register_51 = [0x06, 0x30, 0x35, 0x31, 0x0d, 0x0a];
//.R1.0030().
let request_register_R1_30 = [
local data_raw = require("data_raw");
local json = require ("dkjson");
local str = json.encode (data_raw, { indent = true });
local current_outFile = io.output();
io.output("data_raw.js");
io.output():write(str);
io.output():flush();
io.output():close();
io.output(current_outFile);
os.exit(0);
void S_to_bit_vector(u32* S, int count, u32* out){
for(int i = 0; i < count; i++){
//assuming 32-bit integers
u32 integer_index = S[i] / 32u;
//mask all bits that fit
u32 bit_index = S[i] & 31;
out[integer_index] |= 1<<bit_index;
}
}
/******************************************************************************
Online C Compiler.
Code, Compile, Run and Debug C program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <stdio.h>
#include <stdlib.h>
class A {
private:
int p_i;
public:
A(int i) : p_i(i){}
A(const A& a) : p_i(a.p_i){}
operator int(){ return p_i; }
};
int main(){
@Madsy
Madsy / build-65816-gas-toolchain.sh
Last active April 2, 2019 19:39
SNES 'lorom' toolchain.
#!/bin/bash
PREFIX=$(HOME)/snes-toolchain
#clone binutils development branch
git clone git://sourceware.org/git/binutils-gdb.git binutils-gdb
cd binutils-gdb
# Checkout a *very* old binutils commit from 2005, as gas support for the coff-w65 target was discontinued a long time ago.
# This version is the best one I found so far.
git checkout 0fdc72dad81fc7f32b898cb408da0300667f728b

How to build wine2.9 staging which supports Blizzard's Overwatch

Overview

gamax92's wine repo has the DirectX11 overwatch patches already applied. We need to build this version of Wine with WOW64 support. That is, the 64-bit version of wine which also supports 32-bit Windows programs. In so many words: if your CPU is 32-bit only, don't bother and you couldn't run Overwatch anyway.

Building wine with WOW64 support requires boostrapping the final build. The three stages look like:

  1. Build the 64-bit version of wine (pass --enable-win64 to ./configure)
#include <cmath>
#include <vector>
#include <SDL/SDL.h>
#include <IL/il.h>
#include <math.h>
const float PI = 3.14159265359f;
typedef struct {
unsigned int id;
c*x^2-2*b*x^2+a*x^2+2*b*x-2*a*x+a
Derive formula for quadratic bezier curve:
Interpolate from start point towards control point:
v1 = a + (b-a)*t
Interpolate from control point towards end point:
v2 = b + (c-b)*t
Interpolate between the two points computed from v1 and v2 (v is our point on the curve for any t in [0, 1]):
v = v1 + (v2 - v1)*t
/*
Conditional pattern:
teq (root)
-teq
Equivalent C code:
*/
if(root){
} else {
if(-teq_0){