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
/* Foreach loop in GNU C, released in the public domain by Joe Davis. | |
* Credit would be nice ;) | |
*/ | |
#ifndef FOREACH_H_ | |
#define FOREACH_H_ | |
#include <stdbool.h> | |
#include <string.h> |
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
/* Example usage of "let" */ | |
#include "let.h" | |
int | |
main (int argc, char *argv[]) | |
{ | |
let ((x, 42), | |
(y, 3.14159)) | |
{ |
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
// Singleton with statically allocated storage, useful for embedded systems, | |
// operating system kernels and driver development. | |
/* | |
* Written in 2014 by Joe Davis <[email protected]> | |
* | |
* To the extent possible under law, the author(s) have dedicated all copyright | |
* and related and neighboring rights to this software to the public domain | |
* worldwide. This software is distributed without any warranty. | |
* |
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
#![feature(macro_rules)] | |
use std::collections::HashMap; | |
macro_rules! map( | |
{ $T:ident $($args:tt)* } => { | |
{ | |
let mut m = $T::new(); | |
map_insert! { m $($args)* } | |
} |
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
#![feature(macro_rules)] | |
#![feature(globs)] | |
use std::fmt::*; | |
macro_rules! bitfield( | |
{ $name:ident: $repr:ty, | |
$(($getter:ident, $setter:ident): $width:expr),+ } => ( | |
#[packed] | |
#[deriving(Show)] | |
struct $name($repr); |
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
#!/usr/bin/env python3 | |
""" | |
Animation of the Schrodinger equation for a particle in a 1D box | |
-∂²/∂x² ψ(x,t) = i ∂/∂t ψ(x,t) (natural units) | |
for a non-eigenstate initial state ψ, with boundary conditions | |
ψ(0,t) = ψ(1,t) = 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
Index: sysupgrade.sh | |
=================================================================== | |
RCS file: /cvs/src/usr.sbin/sysupgrade/sysupgrade.sh,v | |
retrieving revision 1.26 | |
diff -u -p -r1.26 sysupgrade.sh | |
--- sysupgrade.sh 14 Oct 2019 06:58:53 -0000 1.26 | |
+++ sysupgrade.sh 15 Oct 2019 19:30:14 -0000 | |
@@ -25,7 +25,7 @@ umask 0022 | |
export PATH=/usr/bin:/bin:/usr/sbin:/sbin | |
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 std = @import("std"); | |
pub const Headers = std.StringHashMap([]const u8); | |
pub const StatusCode = enum(u32) { | |
@"continue" = 100, | |
switching_protocols = 101, | |
processing = 102, | |
early_hints = 103, |