![Cheesed Up](/img/default-banner.jpg)
- Видео 20
- Просмотров 183 627
Cheesed Up
Словения
Добавлен 13 июл 2021
Hey! I''m a software developer with strong interest in hardware and firmware topics.
On this channel, I look at interesting projects from across the whole stack.
Some topics I talk about:
- Embedded development,
- Programming (C, Python, Go, Rust, Java, JavaScript, Shell, You name it!)
- 3D printing
- Neovim
- Linux
- ...
If you're interested, click the SUBSCRIBE button!
On this channel, I look at interesting projects from across the whole stack.
Some topics I talk about:
- Embedded development,
- Programming (C, Python, Go, Rust, Java, JavaScript, Shell, You name it!)
- 3D printing
- Neovim
- Linux
- ...
If you're interested, click the SUBSCRIBE button!
Save Money With Free and Open Source Software! | FOSS
Let's imagine a simple example of how changing the programs you use to open source alternatives not only improves your experience in the long run, but can also save you money!
Disclaimer: Not a financial advice!
Disclaimer: Not a financial advice!
Просмотров: 25
Видео
Linux Shell in 57 Lines of Rust | bubble-shell
Просмотров 6 тыс.14 дней назад
How does a shell work? What does it do? Let's walk through the code of a tiny implementation of a unix shell which fits in under 60 lines of Rust! source: github.com/JoshMcguigan/bubble-shell
Linux Containers in 41 Lines of Go
Просмотров 7 тыс.21 день назад
Do you know which basic concepts Docker or LXC use? Let's use this tiny Go example to learn how! sources: - video: ruclips.net/video/Utf-A4rODH8/видео.html - article: www.infoq.com/articles/build-a-container-golang/
Microcontr... WHAT? | What I Wish I Knew When Starting Out With Microcontrollers
Просмотров 4,2 тыс.28 дней назад
I want to share a few essentials about microcontrollers. What are they? How to pick an appropriate one for your project? What kind of software can be used to program a microcontroller? And more.
Blockchain in 72 Lines of Python | justblockchain
Просмотров 958Месяц назад
In this video, we are taking a look at a small example of a blockchain implementation in Python. The chain also implements proof of work. original source: github.com/koshikraj/justblockchain
Real-Time Operating System in 96 Lines of C | RIOS
Просмотров 84 тыс.Месяц назад
Let's take a look at the most basic form of an RTOS - a project called RIOS, which in it's most basic form fits under 50 lines of C. RIOS Source: www.cs.ucr.edu/~vahid/rios/
Game of Life in 54 Lines of Python | Conway's Game of Life
Просмотров 1,3 тыс.Месяц назад
In this video, let's quickly look at how a simple stupid implementation of Conway's famous Game of Life looks like in Python. Code based on example from here: www.geeksforgeeks.org/program-for-conways-game-of-life/
System Tray Icon in 176 Lines of C | libayatana-appindicator
Просмотров 759Месяц назад
In this video, let's look at how to create a simple GTK program which includes an app indicator icon in the system tray. Code from: github.com/AyatanaIndicators/libayatana-appindicator
Improve Your Sway Experience With Scripts | My SwayWM Scripts
Просмотров 6412 месяца назад
In this video I'll show you two of my scripts for automating certain aspects of Sway window manager: One for automatic tiling and another for managing scratchpad windows. repository: github.com/kndndrj/sway-scripts
Compiler in 191 Lines of C | tinyc
Просмотров 22 тыс.2 месяца назад
How do compilers actually work? Let's take a look inside the simplest possible compiler, which supports a subset of C and fits into 191 lines of non-comment, non-whitespace C! source: www.iro.umontreal.ca/~felipe/IFT2030-Automne2002/Complements/tinyc.c
New Iterators in Go 1.23
Просмотров 5712 месяца назад
Let's talk about iterators in the upcoming Go 1.23 release - what are they supposed to do, how they look like and are they going to make the language better or worse? sources: - python iterator example: stackoverflow.com/questions/2776829/difference-between-pythons-generators-and-iterators - rangefunc article: go.dev/wiki/RangefuncExperiment
Write a Custom Neovim Dbee Layout Using Lua!
Просмотров 3003 месяца назад
Let's make a custom layout for nvim-dbee. We'll be using the Neovim Lua API and extend the database client plugin! Dbee: github.com/kndndrj/nvim-dbee My config: github.com/kndndrj/nvim
Manage Docker Compose Projects with ease!!
Просмотров 1074 месяца назад
Conductor is my way of managing Docker Compose projects for local development. In this video, I talk about what it does and what problem it is trying to solve. repository: github.com/kndndrj/conductor
nvim-dbee: Interactive Database Client Within Neovim
Просмотров 4,5 тыс.4 месяца назад
keywords: Neovim,Vim,Database,nvim,Database Client,Postgresql,Docker,Golang,Lua,SQL,Neovim Plugin Let's have a quick look into my database client plugin for Neovim! Repository: github.com/kndndrj/nvim-dbee
Computer Mouse from SCRATCH With RUST Firmware!
Просмотров 1,4 тыс.4 месяца назад
Computer Mouse from SCRATCH With RUST Firmware!
You Wouldn't CUT Through a KEYBOARD, Would You?
Просмотров 834 месяца назад
You Wouldn't CUT Through a KEYBOARD, Would You?
Add a Simple LOADING BAR To Your Shell Scripts!
Просмотров 42 тыс.3 года назад
Add a Simple LOADING BAR To Your Shell Scripts!
salute to Richard Stallman the great
Hello, I have a question. I want to know whether Zig language can be better than Rust or not, and why Rust has been getting so much hate for some time now, and what is your opinion about Zig or Rust for creating very bad malware?
I haven't really had a lot of experience with Zig, but the way I see it, they are different languages for different purposes. Zig wants to be more like "the next C", whereas Rust wants to be "the next C++". In terms of Rust getting hate... I'm not sure what you think, but if Rust is getting hate it's probably because of either Rust evangelists (users, who think Rust should be used for everything everywhere unconditionally) or the Rust Foundation (the org behind Rust). For writing malware, I think that very good malware is probably like any good software - it can be written with numerous tools, it's just easier to do it with some. Hope I helped!
"in 191 Lines of C" The lines: if (sym == ID) { x=new_node(VAR); x->val=id_name[0]-'a'; next_sym(); }
I know, I thought the same thing - but I decided to leave the code be as the original author wrote it. I guess we could **improve** the code to make a "compiler in 1 line of C" :D
It make me laugh how new kids to Linux harp on about containers (less so admittedly now Docker is no longer new) yet folk were selling locked down “private” shell access on Unix machines back to the early/mid 1990s! Chroot on steroids as another commenter wrote.
Really is chroot on steroids, that comment made me laugh as well! Jokes aside, I'm very glad that containers are a thing, pushing to prod and development are a lot easier in some circumstances :D
@@cheesed_up sure thing. But the guts of Docker are nothing a competent Unix sysadmin couldn’t knock together in a few hundred lines of /bin/sh.
i was thinking of achieving that with some kind of a buffer for the current tty and using clear to update it to the next one (instead of remembering cursor position)
The family of MCUs you choose depends mostly on the size of project you intend to do now in the future. Recommending an ARM controller is likely to be massive overkill and completely overwhelming for hobbyists and beginners. It's like buying an articulated truck to transport a parcel to the post office - yes, it will do it but it is big, expensive, complex and complete overkill. Arduino would be a much better choice for this target audience. I personally use PIC controllers and program in assembler for small hobby projects.
Thanks for the comment! And yes, I mostly agree with you - in terms of "getting there fast" nothing can beat Arduino.
Great things about the Arduino are that they can be very cheap (depending which version you get), have a thriving community, have comprehensive libraries for many devices, have a simple programming environment and work at a hobbyist friendly 5V. I have everything from simple 8 pin PIC's up to Raspberry Pi's and choose an appropriate scale of device depending on the project. I tend to use mid-range 8-bit PIC's most of the time due to their range of capabilities and small size but I do admit that Microchip's documentation is often confusing or misleading and in some cases is completely wrong! Not ideal for beginners!
great video! How can I implement this in a system update script I made?
I think there should be info about this in the readma (see description for the link to the project). But essentially, you copy these functions to your script and call them at appropriate times.
Super cool!
FYI: This guy has no idea what an RTOS is. Nothing he said about it is true. 🤣
Thanks for the feedback! May I ask what makes you say that? I don't want to spread misinformation and am happy to listen to what you have to say!
for the love of christ never show your code publicly again
I'm wondering if the link in the description was changed or if the people complaining about it don't know how to copy and paste. Even cell phones allow you to copy and paste from descriptions so I can only assume it was altered. That said, it'd be cool if you took the TinyC code and refactored it. Use more modern idioms and maybe add some optimizations to it. Perhaps turn it into an actual compiler that generates either assembly or a binary object file ready to link.
Regarding links: RUclips masks them if the channel is not big enough or something like that.
@@cheesed_up If that's what it was, then congrats on getting big enough. Hopefully that doesn't sound weird.
it seems that all commands in the pipelime get executed at once. what happens when a command in the pipeline exits due to a syntax error? does stderr print to the parent shell directly? great code analysis btw.
I can't say anything for certain - but as you already figured it out, this example is (IMO) very good for getting a feeling for what a shell is and what it does. But it skips on a lot of good practices, including error handling :/. I still recommend playing around with the example - I had quite a lot of fun!
Looks cool, maybe i'll make my own using a round robin sheduler, i'll see
Terrible code! All in s single main ugghhh… 😂 Also there are no spaces required before and after pipeline. So the example code is even flawed 😂
Yes, the code is just an "as dumb as it gets" example. I hope that the video was still enjoyable :)! Thanks for the comment!
@@cheesed_up it was good video for sure!
Great video with no wasted time, good stuff 👍
which color scheme is that?
it's from gleam lang's website - I found it just for VSCode though :/
Thanks for a very clear explanation. I wonder why all the "goto again" s are included rather than the usual style of using break and placing the switch in a do while loop controlled by a handled bool.
Glad that you liked the video! I wondered the same thing, but I gotta admit that even using goto's looks pretty clean. Because of this unexpected observation, I don't want to alter the code of these examples if possible. I like seeing different programming styles, even though I don't necessarily like them!
RTOS doesn't mean a basic OS, though they typically are. It means that they are designed to handle real-time constraints which is difficult to do on bloated OSes, hence why they tend to be stripped down, bare bones implementations.
If I could pin a comment, this would probably be it :D
thanks for this BLAZINGLY FAST and MEMORY SAFE shell, very cool
cd without arguments should drop you into the home directory
I agree. It's probably done this way to avoid handling env vars (I haven't tried if "$HOME/" instead of "/" works though.
Its not R (real time), its not OS. Its just a program, where you moved all task executions into the interrupt handler. To make out of your "interrupt runner" a scheduler, you should at least schedule the tasks from main. Your timer interrupt is then just the producer of your ticks time base (e.g. 1ms per tick). And main() calls your cooperative "schedule()" function within its while loop. To make it a "cooperative real time scheduler", if such a thing exists, you would need to runtime validate the time constraints of each running task, to see if R is violated and then... do something drastic to inform the user (of the device). I recommend a 150dbA siren for that... And you would specify for each (periodic) task, not only its interval, but also its maximum allowed run time per call. To make it an OS, well - some OS indeed are only the scheduler. You could add inter-task communication facilities or something. Or a driver model... The PC version of my especially for this comment hacked up cooperative scheduler thing is around 200 lines + the application code of the demo with 5 cyclic tasks (another 100 lines). here, main() looks like this: int main (int argc, const char* argv[]) { HCOOP coop = CoopInitialize(5); if (0 != coop) { init_tasks(coop); int running = 1; while (running) { running = CoopSchedule(coop); milli_sleep(10*1000); } } CoopTerminate(coop); return 0; } The milli_sleep() is not for the embedded case, but even there, you might want to save power while nothing is running. (HALT instruction on some CPU and let the timer interrupt wake you up.) The scheduler just runs tasks, which need running according to the current tick-time. int CoopSchedule(HCOOP domain) { CoopDomain_t* coop = (CoopDomain_t*)domain; if (NULL != coop) { uint64_t now = atomic_load(&coop->ticks); for (size_t i = 0; i < coop->tasksEnd; i++) { if (now >= coop->tasks[i].next_due) { coop->tasks[i].next_due = now + coop->tasks[i].interval; if (TEST_FLAG(coop->tasks[i].flags, TASK_FLAG_ENABLED) && NULL != coop->tasks[i].body) { coop->currentTaskId = coop->tasks[i].id; coop->tasks[i].body(domain); } } } return coop->running; } return 0; } I use atomics, because my ticks are being incremented in an extra thread (kinda simulating the ISR of a timer). And just because I wanted to.
I would classify this channel the ‘The Joy of Programming’, it is like Bob Ross but with code. “Now let me just paint this happy little shell right here in my VIM. Don’t be afraid of that loop, it will keep you safe while you structure your -painting- program.”
made my day, thanks :D
Wow!
Nice…❤
Not sure if a minimalist scheduler running on a microcontroller qualifies as an operating system, but hey. It's kind of cute.
To add to this: I'm not sure if an RTOS qualifies as an operating system :D
there is also Time namespace, he, is missing on video
I like the ESP32 because it's a SoC microcontroller! WiFi and Bluetooth on board is great, plus ESP-NOW! What I don't like about the ESP32 is that the ADC inputs work strangely!
Cool & interesting video! We need more like this !
from 6:55 to 6:58, you show us a list of topics. im interested in looking at the whole list, what's the source? great video by the way
Sure: www.grymoire.com/Unix/Sh.html - it's a pretty interesting site!
Rust...the woke language.
Yes, I think its time to rewrite this channel in Rust!
These projects take my understanding of shells and OSs from “unfathomably complex millions of lines of code” to “quite easy if you’re ok with it not being the next Linux”.
I'm very glad that you like it! That was my goal with these "Something in N lines of code" videos :D
rUsT
Very cool
is arch's sh not posix compliant? if [ $(($bar_count % $percent)) -lt 100 ]; then won't stop complaining about the %
avrdude..... gr8 naming right there
Excellent explanation!
thank you
I only understood line 26
ASCII stuff
Very cool but how is this actually different from just regular old embedded programming?
I don't think it's different. This is just an example of how a basic preemptive scheduler might look like.
You shoulda just said I use Neovim at the beginning... sheesh
Are there any sort of performance benchmarks, or reasons that I wouldn't want to use a docker container compared to this technique? We often use containers to build against platforms and libraries that are not on the host machine.
this isn't a tutorial this is just learning how most Linux containers work
I don't understand why there is no LISP like low-level programming language. If the syntax was a LISP, then the compiler would not have to worry about converting tokens into an AST, because who cares about that anyway? The job of the compiler is to produce portable or optimized code, not do re-invent wheels. Imagine a C like low-level systems programming language that forces their users to write in a LISP like syntax, so that the context of any number of operations and functions is crystal clear for the compiler (and unambiguous). The compilers would have a lot less complexity that way and can focus on stuff that makes them "magic" (all the implicit re-writes and transformations that makes code faster). Just my thoughts that were spontaneously popping in my head as I was listening to this video...
Crystal clear to the compiler but hard on the human with *L* ots of *I* rritating *S* uperfluous *P* arentheses. 🙂 (A very old joke).
Very nice!
Pure gold! What a coincidence! Just what I needed
Really informative video! My only critique is your microphone makes it a little hard to hear your voice sometimes. The auto-generated subtitles help a lot, but if you could work on that for future videos that would be amazing. Your actual content and how you speak is great, keep it up!
Thanks for the feedback! I need to learn how to work with sound and buy a new microphone!
Docker = chroot on steroods
Thank you sir
You cannot possibly call a simple scheduler like this a "real time operating system". This is nothing more than ready made boilerplate.
I agree, if this was a "real" project, calling it RTOS would be a bit arrogant to say the least. However, since this is ane ducational example, I don't blame the authors for calling it that. Do you agree?
Can you provide a source for the tinyc code? Im afraid the link in the description doesnt work
Should be there now!
@@cheesed_upthank you so much! Im cheesed to say im subscribed