This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use wgpu::{Buffer, BufferUsages, Device}; | |
use wgpu::util::{BufferInitDescriptor, DeviceExt}; | |
use crate::vertex::Vertex; | |
pub struct Mesh { | |
vertex_buffer: Buffer, | |
index_buffer: Buffer, | |
vertex_count: usize, | |
index_count: usize, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.program panic | |
set pindirs, 1 | |
pull block | |
out y, 32 | |
.wrap_target | |
mov x, y | |
set pins, 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use async_std::{fs, path::Path, prelude::*}; | |
use rand::{prelude::*, thread_rng}; | |
use std::io::{Error, ErrorKind}; | |
use wallpaper; | |
const WALLPAPER_DIR: &'static str = "/home/zack/Pictures/Wallpapers"; | |
const ACCEPTED_EXTENSIONS: [&str; 3] = ["jpeg", "jpg", "png"]; | |
async fn read_wallpapers() -> Result<Vec<String>, Error> { | |
let base_path = Path::new(WALLPAPER_DIR); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[cfg(test)] | |
mod tests { | |
use super::*; | |
#[test] | |
fn test_addition() { | |
let program = vec![ | |
Operation::Store(0, 45), | |
Operation::Store(1, 30), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use serde::{Deserialize, Serialize}; | |
#[derive(Serialize, Deserialize, Debug)] | |
#[serde(untagged)] | |
enum Stuff { | |
Array(Vec<u8>), | |
Number(u8), | |
} | |
#[derive(Serialize, Deserialize, Debug)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from matplotlib import pyplot | |
class Viewport: | |
def __init__(self, rng, *rest): | |
if len(rest) == 0: | |
self.array = [-rng, rng, -rng, rng] | |
elif len(rest) == 1: | |
self.array = [rng, rest[0]] * 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline') | |
const uuid = require('uuid/v4') | |
const knex = require('knex')({ | |
client: 'sqlite3', | |
connection: { filename: './database.db' }, | |
useNullAsDefault: true | |
}) | |
const rl = readline.createInterface({ | |
input: process.stdin, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! hashmap { | |
($($key:expr => $value:expr), +) => ({ | |
let mut map = std::collections::HashMap::new(); | |
$( | |
map.insert($key, $value); | |
)+ | |
map | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
int do_operation(int a, int b, char operator) { | |
switch (operator) { | |
case '+': return a + b; | |
case '-': return a - b; | |
case '*': return a * b; | |
case '/': return a / b; | |
default: return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main(){char*a="abacbabcbbbcbabcbabc";while(*a)putchar(" #\n"[*a++-'a']);} |
NewerOlder