Twitter Text Obj
Twitter Text Obj | totally-safe-transmute | |
---|---|---|
9 | 17 | |
3,056 | 245 | |
0.2% | - | |
0.0 | 0.0 | |
7 days ago | over 1 year ago | |
HTML | Rust | |
Apache License 2.0 | - |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Twitter Text Obj
-
Why is GPT-3 15.77x more expensive for certain languages?
I recall that Twitter allowed 140 Chinese characters in tweets originally, but when they switched to 280 ascii characters, CJK languages were not included. The current documentation does say that some languages and emojis use 2 characters per symbol of the 280 limit, limiting those languages to 140. https://developer.twitter.com/en/docs/counting-characters
-
Mini Musk in making
I assume you we’re going for half of the (new) character limit? That wouldn’t be bad as a rough guess, except Twitter uses UTF-8 encoding and what counts as a character is a bit complicated. Certain objects like usernames in a reply or image URLs hosted on Twitter are not counted, either. The maximum size of a modern tweet could therefore be upwards of 280 x 4 = 1,120 bytes.
-
A rust crate that lets you compress ASCII text to a single Unicode "character"
Given the examples in this article it seems like it could potentially be used for this!
-
Tweet-counter: A module to calculate the length of a tweet
It turns out, working this out is non-trivial, as Twitter has a few rules around how it count's characters. These are basically:
-
[DISC] The Tsunderedere Girl Getting More and More Dere Day by Day | Day - 13 by @yakitomahawk & @kota2comic
Japanese, Korean and Chinese were excluded from that increased cap, because they already had a significant advantage in being able to put more information into a single character. (More specifically, it's implemented such that ideograms count as 2 characters now, and emoji do, too.)
- Guinness World Regex
-
TIL the assumption that string length does not change when upper-cased is false
The 280 character limit in a tweet isn't equal to the number of glyphs in a tweet.
https://developer.twitter.com/en/docs/counting-characters
- Tech skill shortage
totally-safe-transmute
-
Sudo Replacement
For example, there is this (pure safe Rust) code: https://github.com/ben0x539/totally-safe-transmute/blob/main... which accesses external resources (/proc/self/mem) in order to violate the safety guarantees.
-
A rust crate that lets you compress ASCII text to a single Unicode "character"
The first is the totally_safe_transmute crate. I mean, who wouldn't love library code that has .expect("welp") and .expect("oof") as its error handling? But that's not even the really scary part. Issue #2 ("i hate this") remains open to this day, but for obvious reasons there's no chance of resolution. This post has some context and a line-by-line explanation of how it works.
-
What do you expect from Rust in 2023?
You mean like this?
-
In C# you can transmute without `unsafe`
You can also do that in rust on linux: https://github.com/ben0x539/totally-safe-transmute/blob/master/src/lib.rs
-
Why choose Rust
I want to correct this statement: Rust can be safer, but not if a library you use contains unsound code. Unsoundness is most often caused by unsafe code, but not always (totally_safe_transmute, anyone?). There is a misconception that unsafe code blocks are always unsound and should be avoided at all costs, but they're completely fine if the safety contracts are upheld. In fact, unsafe blocks isolate the potential issues to make it easier to identify where undefined behavior may be occurring. unsafe code blocks are a feature of the language, and their usage should not be viewed as opting out of any safety the language provides, imo.
-
"# NONONONONONO DON'T YOU FUCKIN' DARE the safety features are there so that your programs aren't filled to the brim with security vulnerabilities. Unless you care A LOT(And I mean A LOT A LOT) about compile times, never use `unsafe`."
Just reimplement totally_safe_transmute in Zig. No need for unsafe.
-
I mean, it solves most library conflicts
Why transmute() when you can totally_safe_transmute()?
- Safe Transmute
-
Static Analyzer Rudra Found over 200 Memory Safety Issues in Rust Crates
Well, there is always the totally-safe-transmute.
-
// SAFETY: NO
They should use https://github.com/ben0x539/totally-safe-transmute
What are some alternatives?
MarkdownTextView - Rich Markdown editing control for iOS
tinyvec - Just, really the littlest Vec you could need. So smol.
YYText - Powerful text framework for iOS to display and edit rich text.
tamago - TamaGo - ARM/RISC-V bare metal Go
Iconic - :art: Auto-generated icon font library for iOS, watchOS and tvOS
rust - Rust language bindings for TensorFlow
DTCoreText - Methods to allow using HTML code with CoreText
usbarmory - USB armory - The open source compact secure computer
Atributika - Convert text with HTML tags, links, hashtags, mentions into NSAttributedString. Make them clickable with UILabel drop-in replacement.
advisory-db - Security advisory database for Rust crates published through crates.io
PhoneNumberKit - A Swift framework for parsing, formatting and validating international phone numbers. Inspired by Google's libphonenumber.
UnsoundCrates - Black list of all crates that promotes unsoundness