Skip to content

Instantly share code, notes, and snippets.

View PiyushXCoder's full-sized avatar

Piyush मिश्र: PiyushXCoder

View GitHub Profile
@PiyushXCoder
PiyushXCoder / linked_list.rs
Created December 31, 2025 20:05
IntrusiveList in rust
use std::fmt::Debug;
use std::marker::PhantomData;
use std::ptr::NonNull;
#[derive(Debug)]
struct Node<T: Debug> {
value: T,
next: Option<NonNull<Node<T>>>,
prev: Option<NonNull<Node<T>>>,
}
@PiyushXCoder
PiyushXCoder / main.rs
Last active February 5, 2026 07:18
Type erasure in rust
//!
//! Type erasure is a fancy name for a very down-to-earth trick: you throw away
//! some type information at compile time, but still keep the values around at
//! runtime. The program still works, but the runtime no longer knows the specific
//! type; only the behavioral interface remains.
//!
//! It is like void pointer in rust
//!
use std::{marker::PhantomData, ptr::NonNull};
@PiyushXCoder
PiyushXCoder / Xfce4-notes-background.md
Last active August 16, 2022 10:49
Xfce4 notes plugin background colour 1.9.0

Settings to change background colour have been removed from xfce4-notes plugin but you can still set it by running in terminal

xfconf-query -c xfce4-panel -p /plugins/notes/global/background-color -t string -s "#219466" --create

You can also let the default gtk theme to be used to be used for background color

xfconf-query -c xfce4-panel -p /plugins/notes/global/background-color -t string -s "" --create reboot after running it

@PiyushXCoder
PiyushXCoder / solve.rs
Created June 28, 2021 01:59
Simple math expression evaluator for rust
use std::fmt;
use std::error::Error;
use Khand::*;
use Opr::*;
#[derive(Debug)]
enum Khand {
NUM(f64),
OPR(Opr),
@PiyushXCoder
PiyushXCoder / main.rs
Last active February 3, 2021 10:14
rust colored text in linux shell example
use colored::*;
static LEKH: &str = r##"
4 4 4 4
4 4 4 4 4 4 4 4
| | | |
/ = \ / = \ / = \ / = \
| | | | | | | | | | | |
= = = = = = = = = = = = = = =
| # # # # # # # # # # # # # |