Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View HackerFoo's full-sized avatar

Dusty DeWeese HackerFoo

View GitHub Profile
@HackerFoo
HackerFoo / relations.rs
Created October 24, 2021 06:25
WIP Bevy Relations
use crate::*;
pub trait Relation
where Self: Component + From<Self::Entities>,
for<'a> &'a Self::Entities: IntoIterator<Item = &'a Entity>,
{
type Entities: PartialEq;
fn entities(&self) -> &Self::Entities;
fn disassociate(&mut self, _entity: Entity) {}
fn set_entities(&mut self, entities: Self::Entities);
,------------------,
,--------' Popr Interpreter '--------,
| Copyright 2012-2020 Dustin DeWeese |
'------------------------------------'
type :help for help - https://popr.dev
Load lib.ppr (lib, num, list, stack, control, logic, algorithm, io)
Load tests.ppr (tests)
Importing all modules (algorithm, control, io, lib, list, logic, num, stack, tests)
: :bc add: +
use bevy::{
prelude::*,
render::{
pipeline::PrimitiveTopology,
wireframe::{Wireframe, WireframeConfig, WireframePlugin},
mesh::{Mesh, Indices},
},
wgpu::{WgpuFeature, WgpuFeatures, WgpuOptions},
};
use facet::{
// To compile: clang++ -std=c++11 ptrdiff.cpp -o ptrdiff
// To run: ./ptrdiff
#include <vector>
#include <numeric>
#include <cassert>
#include <iostream>
int main() {
#!/usr/bin/env bash
# Download from a Nix cache to a tarball
# --------------------------------------
# This script takes the part of the store path after /nix/store as the argument to specify what to download
# You can find this in the build details page on Hydra under "Output store paths".
# Requirements: nix, curl, xz (zxdec)
set -e
Info: Packing constants..
Info: Inserting IO buffers..
Info: IO port 'clk' driven by IBUF '$iopadmap$top.clk'
Info: IO port 'di' driven by IBUF '$iopadmap$top.di'
Info: IO port 'do' driven by OBUF '$iopadmap$top.do'
Info: IO port 'stb' driven by IBUF '$iopadmap$top.stb'
Info: Constraining 'clk' to site 'IOB_X1Y26'
Info: Constraining 'di' to site 'IOB_X0Y11'
Info: Constraining 'do' to site 'IOB_X0Y43'
Info: Constraining 'stb' to site 'IOB_X0Y3'
@HackerFoo
HackerFoo / converter.v
Last active December 10, 2019 22:15
N -> 2N bit stream converter
module converter (
input clk,
input nrst,
input [N-1:0] in,
input in_valid,
output in_ready,
output [2*N-1:0] out,
output out_valid,
input out_ready
);
{ pkgs ? import <nixpkgs> {} }:
# https://sid-kap.github.io/posts/2018-03-08-nix-pipenv.html
let manyLinuxFile =
pkgs.writeTextDir "_manylinux.py"
''
print("in _manylinux.py")
manylinux1_compatible = True
'';
in (pkgs.buildFHSUserEnv rec {
# command line go links
# just copy this to ~/.go.bash and source it
# add new commands below
function go () {
# self update
source ~/.go.bash
# indirect call
NAME="$1"
module top (
input clk,
input [15:0] in,
output [15:0] out
);
reg [15:0] out_buf;
reg [3:0] addr;
reg [15:0] ring_in;
reg [15:0] ring_out;