Skip to content

Instantly share code, notes, and snippets.

💭
I may be slow to respond.

Dan Glastonbury djg

💭
I may be slow to respond.
Block or report user

Report or block djg

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View LLC Misses
0.17 │ xor ebp,ebp ▒
1.77 │ nop ▒
6.54 │150:┌─→cmp r12,rbp ▒
│ │↓ je 170 ▒
│ │_ZN4core4iter8adapters13copy_try_fold28_$u7b$$u7b$closure$u7d$$u7d$17h5801f96c3ce42993E(): ▒
1.49 │ │ mov edi,DWORD PTR [r9+rbp*1]
@djg
djg / reading-list.md
Last active Oct 23, 2019
Fabian's Recommened Reading List
View reading-list.md
@djg
djg / alu.rs
Created Aug 16, 2019
Proposed FHDL in Rust
View alu.rs
struct Alu {
pub sel: Signal,
pub a: Signal,
pub b: Signal,
pub o: Signal,
pub co: Signal,
}
impl Alu {
#[fhdl]
@djg
djg / alu.rs
Created Aug 16, 2019
Proposed FHDL in Rust
View alu.rs
struct Alu {
pub sel: Signal,
pub a: Signal,
pub b: Signal,
pub o: Signal,
pub co: Signal,
}
impl Alu {
#[fhdl]
View nsRefreshDriver.cpp
void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
MOZ_ASSERT(!nsContentUtils::GetCurrentJSContext(),
"Shouldn't have a JSContext on the stack");
if (nsNPAPIPluginInstance::InPluginCallUnsafeForReentry()) {
NS_ERROR("Refresh driver should not run during plugin call!");
// Try to survive this by just ignoring the refresh tick.
return;
}
View conic_gradient.glsl
// Paste into shadertoy.
void mainImage( out vec4 fragColor, in vec2 fragCoord )
{
vec2 c = (2.0*iMouse.xy - iResolution.xy)/iResolution.y;
vec2 p = (-iResolution.xy + 2.0*fragCoord)/iResolution.y;
vec2 d = c - p;
// angle of each pixel to the center offset by from
float from = radians(mod(10.0*iTime,360.0));
float a = (atan(d.x, d.y) + radians(180.0) - from)/radians(360.0);
View chunky-vec.rs
// snippet of code @ 2019-01-03 09:34:24
// === Rust Playground ===
// This snippet is in: ~/.emacs.d/rust-playground/at-2019-01-03-093424/
// Execute the snippet: C-c C-c
// Delete the snippet completely: C-c k
// Toggle between main.rs and Cargo.toml: C-c b
use std::{
@djg
djg / macros.rs
Created May 27, 2019
Simulating named parameters with rust macros
View macros.rs
#[macro_export]
macro_rules! signal_build {
($name:expr, $shape:expr, $reset:expr, $reset_less:expr) => {
Signal::signal($name, Shape::from($shape), $reset, $reset_less)
};
}
#[macro_export(local_inner_macros)]
macro_rules! signal_collect {
(($_:expr, $shape:expr, $reset:expr, $reset_less:expr) name: $name:expr, $($k:ident: $v:expr,)*) => {
@djg
djg / level2.asm
Last active May 16, 2019
Rust Output At Different Opt Levels
View level2.asm
example::test:
push rax
cmp rsi, 50
jbe .LBB23_1
mov eax, dword ptr [rdx]
mov dword ptr [rdi], eax
mov eax, dword ptr [rdx + 4]
mov dword ptr [rdi + 4], eax
mov eax, dword ptr [rdx + 8]
mov dword ptr [rdi + 8], eax
@djg
djg / CommonItemPropertiesPoke.asm
Last active May 15, 2019
Rust generated code for webrender_api::CommonItemProperties
View CommonItemPropertiesPoke.asm
beagle_bros_test::poke:
cmp rsi, 60
jbe LBB29_8
movups xmm0, xmmword, ptr, [rdx, +, 64]
movups xmmword, ptr, [rdi], xmm0
cmp dword, ptr, [rdx], 1
jne LBB29_2
mov byte, ptr, [rdi, +, 16], 1
mov rax, qword, ptr, [rdx, +, 8]
mov qword, ptr, [rdi, +, 17], rax
You can’t perform that action at this time.