Skip to content

Instantly share code, notes, and snippets.

@Jragon
Jragon / complex.h
Last active February 13, 2018 17:37
#include <cmath>
#include <iostream>
const class Complex operator+(const class Complex &a, const class Complex &b);
const class Complex operator-(const class Complex &a, const class Complex &b);
const class Complex operator-(const class Complex &a);
const class Complex operator*(const class Complex &a, const double b);
const class Complex operator*(const class Complex &a, const class Complex &b);
const class Complex operator/(const class Complex &a, const double b);
const class Complex operator/(const class Complex &a, const class Complex &b);
class HalfAdder : public LogicComponent<2, 2> {
public:
enum Outputs { SUM, CARRY_OUT };
HalfAdder(LogicGate *A, LogicGate *B)
: A_(A), B_(B), sum(A_, B_), carry(A_, B_){};
bool read(int output) {
switch (output) {
case SUM:
return sum.read();
0: mdr = {`STORE, 5'd30}; // disp
1: mdr = {`LOAD, 5'd12}; // bottom - label: :start:
2: mdr = {`STORE, 5'd16}; // i
3: mdr = {`LOAD, 5'd16}; // i - label: :loop:
4: mdr = {`STORE, 5'd30}; // disp
5: mdr = {`ADD, 5'd12}; // bottom - add bottom (instead of inc) to keep within the ROM
6: mdr = {`STORE, 5'd16}; // i
7: mdr = {`LOAD, 5'd13}; // top
8: mdr = {`SUB, 5'd16}; // i
9: mdr = {`BNE, 5'd15}; // :loop:
void voltage_update(property_t *prop) {
//draw_pval(prop);
UG_ConsolePutString("voltage\n");
}
int main(void) {
init_property_timer(5);
sei();
property_t voltage = {.x = 0,
#ifndef GAME_H
#define GAME_H
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <math.h>
#include "gamestates.h"
#include "debug.h"
typedef struct {
rectangle rect, oldRect;
// signed ints
int direction, theta, intercept,
width, height,
// fixed is whether it moves on collision
// hittable is whether it collides
// collision is a flag, if it is high then there is a
// collision and it doesn't check the collision again
fixed, hittable, collision;
$drawings = Get-ChildItem -recurse -Filter "*.vsd"
Write-Host "Converting Visio documents to PDF..." -ForegroundColor Cyan
try {
$visio = New-Object -ComObject Visio.Application
$visio.Visible = $true
foreach ($drawing in $drawings) {
try {
$pdfname = [IO.Path]::ChangeExtension($drawing.FullName, '.pdf')
● wat.service - lol
Loaded: loaded (/etc/systemd/system/wat.service; disabled)
Active: active (running) since Sun 2016-09-25 19:15:52 UTC; 1s ago
Main PID: 7453 (node)
CGroup: /system.slice/wat.service
└─7453 node /usr/bin/lounge start
Sep 25 19:15:52 raspberrypi systemd[1]: Started lol.
@Jragon
Jragon / reg2.py
Created September 24, 2016 15:00
import re
import argparse
parser = argparse.ArgumentParser(description='Parse diff file out xml')
parser.add_argument('--target', metavar='-I', type=str, required=True,
help='relative path to the input diff file')
parser.add_argument('--out', metavar='-O', type=str, default='out.xml',
help='relative path to the output file')
args = parser.parse_args()
from math import sqrt
class Board():
def __init__(self, size):
self.size = size
self.squareSize = sqrt(self.size)
self.board = self.generateBoard(size)
def generateBoard(self, size):