i don't know much
but I feel a lot βΆ
i don't know much
but I feel a lot βΆ
WIFI #animation #flipnote #3ds
i must write proofs with these. surely the joker is the axiom of choice
oh man the character.ai lawsuit is SO much worse than the headlines made it out to be:
the header overflows for me but otherwise perfect
gandi did not autorenew **again**
there's now a sidebar for image/polygon layers, and you can export them as GeoJSON
browser icon with green tick, cloud icon with two green ticks, another cloud icon with two green ticks, server icon with one green tick and one red cross
wow fuck cmake
the REST API also has this data, but if you hit this endpoint normally you'll get all the stars *without the starred_at field* unless you include the custom header `Accept: application/vnd.github.star+json`.
sadly I didn't learn this until after making the graphql scripts
just opened the site starlog.jadon.io
the repo has a script to gen a json but here's the graphql for it: github.com/phase/starlo... it takes about 5 secs/100 stars for me. yours especially took a long time lmao
here's one from iOS dev -> Rustaholic with a bunch of Julia sprinkled in?
I love that with some people you can see large transitions like switching from JS to Rust
@nikiv.dev has starred 50k projects... i am astonished this is real data...
building a github star calendar & it looks pretty good! you can hover over each day to get links to what you starred.
π
a more useful example. the point placing is wonky because the leaflet plugins are not playing nicely together.
ArcGIS might also do it but wow is the UI tricky to navigate.. I'm noticing a trend with these geospacial tools
i tried a dozen different tools to do this & all of them could do 10-80% of *that one thing i needed*
QGIS might do this but it's nonfunctional for me - zooming is broken and everything is incredibly slow. the amount of icons on top is frightening
a map with images that you can draw polygons on
jk pls break more i love the updates π
bruh itβs thanksgiving stop breaking my code π
#[cfg(test)] mod tests { use super::*; use reader::read_class::read_class; #[test] fn test_write_class() { let mut expected_class = ClassFile::new(ClassVersion::JDK_11, "example/Foo"); expected_class.add_interface("example/IFoo"); let mut buf = vec![0; 1024]; write_class(&expected_class, &mut buf); let actual_class = read_class(&mut buf).expect("failed to read class"); assert_eq!(expected_class, actual_class); } }
took a detour into making a new crate for jvm bytecode parsing & emitting
/// A thread-safe interner that requires a 'static lifetime. pub struct StaticInternMap { map: RwLock<StringInternMap>, } impl StaticInternMap { pub fn new(capacity: usize) -> StaticInternMap { StaticInternMap { map: RwLock::new(StringInternMap::with_capacity(capacity)) } } /// Intern a string, returning a yarn. /// The yarn is always 128 bits long and may be an inlined string (where len < SSO_LEN) /// or a &'static str pointing into a buffer. /// Safety: &'static self is required because the allocated strings the Yarns may point to /// need to live for the lifetime of the program. pub fn intern(&'static self, name: &str) -> Yarn { if let Some(yarn) = Yarn::inlined(name) { return yarn; } // Safety: Yarn is assuming this 'static lifetime we pass it will never be dropped. // The 'static lifetime within the StringInternMap is only valid // for the life of the map instance, because the String buffers // being pointed to are *owned* by the map. unsafe { // grab read lock, get existing interned string that matches let map = self.map.read().expect("can't grab lock"); if let Some(ptr) = map.find_existing(name) { return Yarn::from_static(ptr); } drop(map); // not already interned, grab write lock let mut map = self.map.write().expect("can't grab lock"); let id = map.store(name); let ptr: &'static str = map.lookup_unchecked(id); return Yarn::from_static(ptr); } } } static STATIC_MAP: LazyLock<StaticInternMap> = LazyLock::new(|| StaticInternMap::new(1024)); pub fn intern(name: &str) -> Yarn { STATIC_MAP.intern(name) }
#[cfg(test)] mod test_intern { use super::*; use std::ptr; /// 16 (u128) on 64-bit machines, 8 (u64) on 32-bit machines const SIZE_OF_YARN: usize = mem::size_of::<Yarn>(); #[test] fn test_inline() { let a = "aa".intern(); let b = "bb".intern(); // check values assert_eq!(a, "aa"); assert_eq!(b, "bb"); assert_eq!(a.as_str(), "aa"); assert_eq!(b.as_str(), "bb"); // check addresses let a_addr: usize = ptr::addr_of!(*a).addr(); let b_addr: usize = ptr::addr_of!(*b).addr(); // these yarns are inlined, so they don't have the same address // (& are stored sequentially on the stack) assert_eq!(a_addr + SIZE_OF_YARN, b_addr, "yarns are not inlined"); } #[test] fn test_intern() { let value = "getInstanceOfSomeClass()Ljava/lang/String;"; let a = value.intern(); let b = value.intern(); // check values assert_eq!(a, b); assert_eq!(a.as_str(), b.as_str()); // the string is in the cache let len = STATIC_MAP.map.read().expect("cant get lock").map.len(); assert!(len > 0); // check addresses let a_addr: usize = ptr::addr_of!(*a).addr(); let b_addr: usize = ptr::addr_of!(*b).addr(); // these yarns are interned, so they have the same address // (& is guarenteed to be 'static) assert_eq!(a_addr, b_addr, "yarns are not interned to the same allocation"); }
switched to byteyarn + a global intern map. small enough strings are inlined while large strings are interned
/// Like a Cow<'a, str> but you can plug in your own type. #[derive(Yokeable)] pub enum Ident<'a, O> { Owned(O), Borrowed(&'a str), } impl<'a, O: Clone + From<&'a str>> Ident<'a, O> { pub fn new(s: &'a str) -> Self { Ident::Borrowed(s) } pub fn as_owned(&self) -> O { match self { Ident::Owned(s) => s.clone(), Ident::Borrowed(s) => (*s).into(), } } /// Any lifetime 'b is fine here because we're always returning an owned ustr. pub fn mutate<'b>(&mut self, f: impl FnOnce(&mut O)) -> Ident<'b, O> { let mut owned = self.as_owned(); f(&mut owned); Ident::Owned(owned) } } /// C is our cart, could be an Arc<[u8]> or something. pub struct ID<C>(Yoke<Ident<'static, Ustr>, C>); impl<C> ID<C> { pub fn as_str(&self) -> &str { let ident = self.0.get(); match ident { Ident::Owned(s) => s.as_str(), Ident::Borrowed(s) => s, } } } pub struct ClassFile<C> { name: ID<C>, }
i think im yoking correctly?
instead of using a Cow<'a, str> here, I'm using ustr to intern strings with a global cache. Ident here can use other owned types too so I can compare different interning solutions
docs.rs/ustr/latest/...
the goal here is to have strings inside the ClassFile be either 1) borrowing data from some "cart" (original loaded/mmapped class bytes) or 2) an owned string.
/// Like a Cow<'a, str> but you can plug in your own type. #[derive(Yokeable)] pub enum Ident<'a, O> { Owned(O), Borrowed(&'a str), } impl<'a, O: Clone + From<&'a str>> Ident<'a, O> { pub fn new(s: &'a str) -> Self { Ident::Borrowed(s) } pub fn as_owned(&self) -> O { match self { Ident::Owned(s) => s.clone(), Ident::Borrowed(s) => (*s).into(), } } /// Any lifetime 'b is fine here because we're always returning an owned ustr. pub fn mutate<'b>(&mut self, f: impl FnOnce(&mut O)) -> Ident<'b, O> { let mut owned = self.as_owned(); f(&mut owned); Ident::Owned(owned) } } /// C is our cart, could be an Arc<[u8]> or something. pub struct ID<C>(Yoke<Ident<'static, Ustr>, C>); impl<C> ID<C> { pub fn as_str(&self) -> &str { let ident = self.0.get(); match ident { Ident::Owned(s) => s.as_str(), Ident::Borrowed(s) => s, } } } pub struct ClassFile<C> { name: ID<C>, }
i think im yoking correctly?
the new render state abstractions are great tho. glad weβre moving off of hard references to objs within rendering code (Player -> PlayerRenderState, ItemStack -> ItemClusterRenderState).
blessed slicedlime breaking my code once again π