Dev Miscellaneous – Telegram
Dev Miscellaneous
342 subscribers
884 photos
6 videos
5 files
917 links
A channel where you can find developer tips, tools, APIs, resources, memes and interesting contents.

Join our comments chat for more.

Comments chat (friendly :D)
https://news.1rj.ru/str/+r_fUfa1bx1g0MGRk
Download Telegram
3
How an empty S3 bucket can make your AWS bill explode

Imagine you create an empty, private AWS S3 bucket in a region of your preference. What will your AWWS bill be the next morning?

https://medium.com/@maciej.pocwierz/how-an-empty-s3-bucket-can-make-your-aws-bill-explode-934a383cb8b1

@DevMisc
#aws #devops #fun
🤯1
😁31
A Single Div

A CSS drawing experiment to see what's possible with a single div.

https://a.singlediv.com/

@DevMisc
#css #web #design #fun
1
Hardest Problem in Computer Science: Centering Things

https://tonsky.me/blog/centering/

@DevMisc
#web #css #learn
2
🔥2
4🤣4
2024's youareanidiot for Chrome users

It exploits Web APIs, and it's actually overpowered.

https://github.com/feross/TheAnnoyingSite.com
theannoyingsite.com (beware of opening it, it's not a virus but it can induce seizures and earrape)

@DevMisc
#fun #web #misc #security
🔥2😁1
Python's many command-line utilities

Every command-line tool included with Python. These can be run with python -m module_name.

https://www.pythonmorsels.com/cli-tools/

@DevMisc
#python #utils #cli
3👍1
Hacking Millions of Modems (and Investigating Who Hacked My Modem)

The author discovered that someone was intercepting and replaying his web traffic, which indicated his home network or modem had been compromised. After investigating, he found the IP address belonged to DigitalOcean and had previously been used for phishing and malware campaigns. The author was unable to keep the potentially compromised modem when getting a replacement, so he had to give it back to his ISP, Cox. Years later, the author's cybersecurity friends looked into the incident further and discovered the IP address was part of a domain generation algorithm used by malware. They also found that the Cox business portal had an exposed API that could be used to access and control customer modems without authorization. The author reported the vulnerabilities to Cox, who quickly fixed the issues.


https://samcurry.net/hacking-millions-of-modems

@DevMisc
#security #writeup #misc
🔥3
Sei pays out $2M bug bounty

In April 2024, the author discovered and reported two critical bugs to the Sei Network blockchain. The first bug would have caused the chain to halt if exploited, while the second bug would have allowed an attacker to freely transfer funds out of any account. The Sei Foundation awarded the author $75,000 and $2,000,000 respectively for these reports. The issues were caught after auditing but before being deployed to mainnet, preventing any funds from being put at risk. The author provided detailed technical explanations of how the bugs worked and how they were ultimately fixed by the Sei team.


https://usmannkhan.com/bug%20reports/2024/06/17/sei-bug-report.html

@DevMisc
#security #crypto #misc
🔥6
⚠️ RegreSSHion: RCE in OpenSSH's server, on glibc-based Linux systems

- The vulnerability is a regression of a previous issue (CVE-2006-5051) that was introduced in OpenSSH 8.5p1 in October 2020.
- The vulnerability allows for remote code execution as root on glibc-based Linux systems due to the SIGALRM handler calling non-async-signal-safe functions like syslog().
- Older vulnerable OpenSSH versions like 3.4p1 and 4.2p1 can be exploited by interrupting free() calls and leveraging heap corruption techniques like unlink() and House of Mind.
- Newer vulnerable versions like 9.2p1 can be exploited by interrupting malloc() calls and corrupting FILE structures to gain arbitrary code execution.
- Precise timing and network delay mitigation techniques are critical to winning the signal handler race condition.
- The exploit requires carefully crafting the heap layout and leveraging leftover data from previous allocations.
- OpenBSD is not vulnerable because it uses a safer syslog_r() function in its SIGALRM handler.
- The vulnerability is present in the default configuration of OpenSSH and affects the privileged sshd process.
- Significant effort and multiple iterations were required to develop reliable exploits for the different OpenSSH versions.
- The research demonstrates the continued need for vigilance in secure software development, as even a well-designed system like OpenSSH can have subtle regressions that introduce critical vulnerabilities.


https://www.qualys.com/2024/07/01/cve-2024-6387/regresshion.txt

@DevMisc (🟠 comments)
#security #ssh #linux
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥2
Reverse Engineering Ticketmaster's Rotating Barcodes

- TicketMaster has moved away from traditional printable PDF tickets in favor of a proprietary "SafeTix" system that uses rotating barcodes displayed on a mobile device.
- The rotating barcodes are meant to prevent ticket fraud, but the author argues they create significant usability issues, especially when cell service is poor at venues.
- TicketMaster markets SafeTix as a solution to ticket scalping and fraud, but the author believes the real motivations are to lock users into TicketMaster's ecosystem and make it harder to resell tickets outside their platform.
- The author was able to reverse engineer the SafeTix system and discovered it uses Time-based One-Time Passwords (TOTPs) along with a static bearer token to authenticate tickets.
- With the TOTP secrets and bearer token, the author could theoretically generate valid barcodes and bypass TicketMaster's security measures.
- TicketMaster makes it easy to extract the necessary token information by printing it to the browser console when the barcode is loaded.
- The author is uncertain about the lifetime of the TOTP tokens, but believes they may only be valid for up to 20 hours before the event based on TicketMaster's documentation.
- The author developed a tool called "TicketGimp" that can render valid SafeTix barcodes using the extracted token information.
- The author is highly critical of TicketMaster's practices, accusing them of using technology to exclude and disadvantage customers for their own financial gain.
- The author calls on TicketMaster's developers to have more integrity and use their technical skills responsibly, rather than enabling TicketMaster's "cruel business practices".


https://conduition.io/coding/ticketmaster/

@DevMisc
#web #rev #misc
2👍2
Python has too many package managers

- Python has a fragmented package and environment management ecosystem, with over a dozen different tools, each with their own strengths and weaknesses.
- The lack of a standardized, efficient, and user-friendly package manager in Python has been an "inexcusable pain-in-the-ass" for many years.
- Other programming languages like Rust, C#, and JavaScript have developed more cohesive and widely-loved package management solutions like Cargo, NuGet, and npm.
- Python's legacy package manager pip has historically had poor dependency resolution, only recently adding backtracking capabilities. It also lacks environment management features.
- The proliferation of various configuration files like requirements.txt, setup.py, Pipfile, environment.yml etc. has led to a lot of redundancy and lack of standardization in Python package management.
- The introduction of PEP 621 in 2020 aimed to consolidate dependencies and configuration into a single pyproject.toml file, leading to the emergence of new tools like Poetry, PDM, Flit, and Hatch.
- Poetry is currently the closest Python tool to the Cargo experience, but it suffers from slow dependency resolution, especially for large projects.
- Conda is a popular choice for data scientists and experimentalists as it can manage non-Python dependencies, but it lacks some features like lock files and can be cumbersome for production use.
- The Rust community's influence is evident in promising new Python package management tools like uv, which aims to be a fast, Cargo-like drop-in replacement for pip.
- The Python community still lacks a cohesive, standardized, and widely-adopted package management solution, but tools like uv hold promise for the future.


https://dublog.net/blog/so-many-python-package-managers/

@DevMisc
#python #pip #extra
💯3👍1👏1
Why German Strings are Everywhere

- Developed by Umbra (CedarDB's predecessor)
- Adopted by DuckDB, Apache Arrow, Polars, and Facebook Velox

German Strings are a custom string type highly optimized for data processing. They offer significant improvements over traditional C and C++ string implementations.

Key Features:
- 128-bit struct representation (vs. 192 bits in C++)
- Short string optimization for strings ≤12 characters
- Long string format with 4-char prefix for quick comparisons
- Immutable design for better performance and concurrency
- Storage classes: persistent, transient, temporary

Advantages:
- Space-efficient, fitting in two CPU registers
- Reduced allocations and data movement
- Easier parallelization due to immutability
- Flexible lifetime management with storage classes
- Optimized for common database operations (comparisons, sorting)

Trade-offs:
- Requires careful consideration of string usage and lifetime
- Updates are more expensive (but rare in database systems)
- Maximum string length limited to 4 GiB


https://cedardb.com/blog/german_strings/

@DevMisc
#cpp #data #misc
👍5
Counting Bytes Faster Than You'd Think Possible

- The author was able to significantly optimize a byte-counting program, achieving a ~550x speedup over a naive implementation.
- The key optimization was using an interleaved memory access pattern, reading from different 4KB pages in a round-robin fashion, instead of sequential access.
- This interleaved access pattern takes advantage of the "Streamer" hardware prefetcher in modern CPUs, which can maintain separate forward and backward access streams for each 4KB page.
- Interleaving 8 different 4KB pages was found to be the optimal approach, providing up to a 30% performance boost over sequential access.
- The author also unrolled the inner loop to process 2 cache lines (64 bytes) at a time, and added a prefetch instruction to fetch the next set of data.
- The final solution uses AVX2 SIMD instructions to perform the byte counting in a highly efficient manner.
- The author was able to achieve a ranking of #13 on the HighLoad leaderboard with this optimized solution.
- The interleaved memory access pattern seems to be an under-discussed optimization technique, with the author not recalling seeing it used in other code.
- The author encourages readers to share any other memory-based optimizations they are aware of, as the author is interested in learning about them.
- The document provides the full source code for the optimized byte-counting program, allowing readers to study and potentially apply the techniques in their own work.


https://blog.mattstuchlik.com/2024/07/21/fastest-memory-read.html

@DevMisc
#asm #cpp #optimization
1🤯1
Scaling One Million Checkboxes to 650M checks

- The website "One Million Checkboxes" (OMCB) launched on June 26th, 2024 and unexpectedly went viral, attracting millions of users and checkbox checks within the first few days.
- The initial architecture used a single Flask server, nginx reverse proxy, and Redis for state management, but this was quickly overwhelmed by the surge in traffic.
- Key principles for scaling the site included bounding costs, embracing short-term solutions, using simple self-hosted tech, and keeping the experience global.
- Scaling efforts involved adding more Flask servers, implementing batching and connection pooling, and capping bandwidth usage with Linux tc to control costs.
- Bugs like allowing checkbox checks beyond the 1 million limit caused issues that required quick fixes, like truncating the bitset.
- Adding a Redis replica helped spread the load, though finding the private IP address was a challenge.
- Ensuring clients received consistent, up-to-date checkbox state required adding timestamps and logic to handle stale updates.
- Rewriting the backend in Go provided a significant performance boost, allowing the implementation of a "sunsetting" feature to freeze checked boxes over time.
- Using Redis and Lua noscripts made the sunsetting logic simple and race condition-free.
- The author learned valuable lessons about building for the unpredictable nature of the internet, validating their belief in demand for constrained anonymous interactions, and the benefits of launching quickly versus extensive planning.


https://eieio.games/essays/scaling-one-million-checkboxes/

@DevMisc (🟠 comments)
#learn #fun #scaling #misc
Please open Telegram to view this post
VIEW IN TELEGRAM
🔥2
TOTP tokens on my wrist with the smartest dumb watch

- The author has replaced the logic board of a classic Casio F-91W watch with a new ARM Cortex M0+ powered board from Sensor Watch.
- The new board allows the watch to be programmed and customized, including adding features like TOTP (time-based one-time password) support for two-factor authentication.
- The author was able to set up TOTP support for their Google and GitHub accounts, allowing them to access the OTP codes directly on their wrist.
- The author also created a new "ratemeter" watchface that can be used to measure rates, such as rowing strokes or cadence.
- The document provides detailed instructions on how to add TOTP secrets to the watchface code and how the ratemeter watchface was implemented.
- The Sensor Watch project provides a clean and easy to modify set of watchfaces and complications that can be customized.
- The F-91W watch case, combined with the new programmable board, offers a powerful and hackable platform with long battery life.
- The author highlights the availability of a WASM-based emulator that makes it easy to test and play with the custom builds.
- The document mentions other interesting watchfaces available in the Sensor Watch project, including a pulsometer and orrery.
- The author recommends getting a Sensor Watch from Oddly Specific Objects, though they have no affiliation with the company.


https://blog.singleton.io/posts/2022-10-17-otp-on-wrist/

@DevMisc (🟠 comments)
#c #fun #misc
Please open Telegram to view this post
VIEW IN TELEGRAM