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
// TODO: set constraints in no. of bits allowed. currently it's possible to crash a program with invalid bitfield sizes | |
use std::alloc::{alloc, dealloc, Layout, LayoutError}; | |
use std::ops::Drop; | |
use std::ptr::NonNull; | |
fn main() { | |
let mut ptr: FlagPointer<2, _> = FlagPointer::new(1234).unwrap(); | |
println!("value before set = {}", ptr.as_ref()); |
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> | |
void lol_ganda_merda(void) | |
{ | |
int cenas = 0; | |
static void *labels[] = {&&tas_fodido}; | |
tas_fodido: | |
puts("bruh"); |
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
#!/bin/zsh | |
# get git-signify from: https://github.com/sug0/git-signify | |
set -e | |
printf 'Sign commit (y/n)? ' | |
read -sk yn | |
echo $yn | |
case $yn in | |
y|Y) | |
_commit=$(git rev-parse HEAD) | |
for i in {1..3}; do |
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
#![allow(dead_code)] | |
use std::cell::UnsafeCell; | |
use std::mem::MaybeUninit; | |
use std::ops::Drop; | |
use std::sync::atomic::{AtomicUsize, Ordering}; | |
use std::sync::Arc; | |
use arc_swap::ArcSwap; |
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 std::pin::Pin; | |
use std::ops::ControlFlow; | |
use syn; | |
use quote; | |
/// Stackless generator, with no internal data stored | |
/// in itself. | |
pub trait Generator { | |
/// Data persisted across yield points, as well as |
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
#!/bin/sh | |
set -e | |
main() { | |
parse_args $@ | |
capture_screen | |
} | |
parse_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
// next up: scott encoding https://en.wikipedia.org/wiki/Mogensen%E2%80%93Scott_encoding | |
package main | |
import "fmt" | |
type Church[T any] func(func(T) T) func(T) T | |
func main() { | |
churchTest[int](0, func(x int) int { return x + 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 std::collections::{BTreeMap, BTreeSet}; | |
use std::env; | |
use std::io::{self, BufRead}; | |
#[derive(Debug, Default)] | |
struct Node { | |
terminal: bool, | |
children: BTreeMap<char, Node>, | |
} |
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
// Copyright (C) 2022 Tiago Carvalho <[email protected]> | |
// | |
// Permission to use, copy, modify, and/or distribute this software for any | |
// purpose with or without fee is hereby granted. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | |
// FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
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(iter_array_chunks)] | |
#![feature(hasher_prefixfree_extras)] | |
use std::collections::hash_map::DefaultHasher; | |
use std::hash::{Hash, Hasher}; | |
#[derive(Clone, Debug)] | |
struct Tree<T> { | |
root: Option<Node<T>>, | |
} |
NewerOlder