Skip to content

Instantly share code, notes, and snippets.

View nwtnni's full-sized avatar

Newton Ni nwtnni

View GitHub Profile
@nwtnni
nwtnni / ldd3.py
Created May 2, 2023 19:47
Download and concatenate Linux Device Drivers (3ed.) chapters into one PDF
import asyncio
chapters = [
"TITLE",
"COPYRIGHT",
"ldr3TOC.fm",
*[f"ch{index:02}" for index in range(19)],
"ldr3IX.fm",
]
@nwtnni
nwtnni / cloneEntity.rs
Last active April 23, 2024 14:11 — forked from GianpaoloBranca/cloneEntity.rs
Copy all components from an Entity to another in Bevy
//! Bevy Version: 0.10
//! Original: https://gist.github.com/GianpaoloBranca/17e5bd6ada9bdb04cca58182db8505d4
//! See also: https://github.com/bevyengine/bevy/issues/1515
use bevy::ecs::system::Command;
use bevy::prelude::*;
pub struct CloneEntity {
pub source: Entity,
pub destination: Entity,
@nwtnni
nwtnni / makefile
Created September 14, 2022 18:48
CS 375 Updated Makefile
# makefile - Used to make CS 375 compiler in C
# 21 Sep 04; 07 Feb 17; 11 Jan 18; 06 Oct 21
#
# Gordon S. Novak Jr.
#
# token.h is assumed to be a local file because on some machines
# or yacc versions tokenb.h must be used instead (renamed token.h).
# To compile starter file lex1.c --> lex1
#
@nwtnni
nwtnni / main.rs
Last active February 21, 2019 18:31
CodyCigar JSON Problem
#[macro_use]
extern crate serde_json;
use serde_json::Value;
fn extract(json: &Value, path: String, extracted: &mut Vec<(String, String)>) {
match json {
| Value::String(s) => extracted.push((path, s.clone())),
| Value::Null => extracted.push((path, "null".to_string())),
| Value::Number(n) => extracted.push((path, n.to_string())),