DumbIdeas
totally-safe-transmute | DumbIdeas | |
---|---|---|
17 | 6 | |
256 | 66 | |
- | - | |
0.0 | 4.1 | |
about 2 years ago | about 1 year ago | |
Rust | Python | |
- | - |
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.
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
DumbIdeas
-
[2022 Days 1-10] [Python] A graphical representation of The Beast, a single line of code that solves every day's challenge so far!
Decided to try running it through this program, which compresses python into an extremely cursed line that can be run, the creator is able to better explain it than I ever could. It turned out as
-
b='Ę͌͌ͅ͏̰̀͒̏͒͏͇͍͍͈͕͍͒́͒ͅ͏͒́'.encode();print(''.join(chr(((h<<6&64|c&63)+22)%133+10)for h,c in zip(b[1::2],b[2::2])))
Original Python Implementation (Includes a gui, thanks to u/MR_sticky_piston)
-
Day 21. Debug time! You can edit as many lines as you want, or add new lines without changing its intended behavior. The changes from the most upvoted comment get applied.
If you add this on the line before all the beeps, that'll make it linux friendly.
-
A rust crate that lets you compress ASCII text to a single Unicode "character"
This is my port of the incredible python code by /u/_DaCoolOne_. It lets you convert ascii text, e.g. python code, to a single Unicode character in a reversible way. This also lets you refactor your code into a single line! Imagine the readability!
-
T̶h̶e̶ ̶m̶o̶s̶t̶ ̶u̶p̶v̶o̶t̶e̶d̶ ̶c̶o̶m̶m̶e̶n̶t̶ ̶p̶i̶c̶k̶s̶ ̶t̶h̶e̶ ̶n̶e̶x̶t̶ ̶l̶i̶n̶e̶ ̶o̶f̶ ̶c̶o̶d̶e̶:̶ ̶D̶a̶y̶ ̶1̶3̶. Refactor time! Rewrite lines 10-12, so their behavior doesn't change. Whoever gets it with the least amount of symbols, wins. You can use multiple lines.
(Backup link as Reddit formatting will probably bastardize this code: https://github.com/DaCoolOne/DumbIdeas/blob/main/reddit\_ph\_compressor/out.py)
What are some alternatives?
tinyvec - Just, really the littlest Vec you could need. So smol.
base2048 - Binary encoding optimised for Twitter
project-safe-transmute - Project group working on the "safe transmute" feature
aco2022
tamago - TamaGo - ARM/RISC-V bare metal Go
advent-of-code - My (mostly) python solutions to Advent of Code
advisory-db - Security advisory database for Rust crates published through crates.io
RedditWritesCode - The mirror of the series "The most upvoted comment picks the next line of code" on Reddit by https://www.reddit.com/user/AggravatingCorner133/
UnsoundCrates - Black list of all crates that promotes unsoundness
nomicon - The Dark Arts of Advanced and Unsafe Rust Programming
base32768 - Binary-to-text encoding highly optimised for UTF-16
Twitter Text Obj - Twitter Text Libraries. This code is used at Twitter to tokenize and parse text to meet the expectations for what can be used on the platform.