Great video. Perfect amount of being informative/educational without dragging your feet, and you come up with a practical piece of software by the end of it. Very well done, hope to see more from you!
I spent a few hours trying to solve the dependency problem that other people had in the comments. Apparently there are some dependencies that he uses in the video that other distros don't have by default. What I did was install these dependencies with "sudo apt-get install libgdk-pixbuf2.0-dev" and "sudo apt-get install libglib2.0-dev" and installed the libnotify dependency too, but I dont remember the command anymore. Then I ran the build command as follows: "gcc -Wall -pedantic -std=gnu99 -o build/rolexhound rolexhound.c $(pkg-config - -cflags gdk-pixbuf-2.0 libnotify) -lnotify". Also, I changed the $PKG_CONFIG_PATH environment variable, but I don't know if that helped in any way. It only worked like this on Ubuntu, I hope it works for you too!
This cunts a legend bro, keep up the work cuzzy. Showing your knowledge without going through at 100x speed and still having a sense of humour and normality about ya (Sorry for bad language, am from Australia is normal here hahahaha😂😂😂😂)
This was a cool video on daemons. I've been looking for good resources all morning and this was the best introduction to getting started with it all. Thanks for the video! :D
Great video man! About a month ago I wrote a daemon in Zig also using inotify, although just to be fancy and learn I decided to use io_uring instead of actively polling events.
that's awesome bro Zig looks like a sweet lang just haven't had the time to learn it. How does io_uring work without polling? Does it emit signals, events or something your program can write handlers for?
@@hoff._world You tell the kernel to do IO operations (read, write, readv, writev, etc...) and letting it do them when it has time and tell you when they're ready, making them asynchronous. In the end you only have to check if the "completion queue" has any items in it, if not, your application continues as normal. It's a little overkill for a little program like this but it was interesting getting to work with it.
@@michaelscofield4524 sick thanks for sharing. In essence then you're doing a non-blocking check somewhere in your main loop and if that turns negative your daemon does other work until it's ready. Which is useful for bigger daemons for sure, especially if networking is involved where it could potentially talk to others as well (we might be doing that sometime :)
Randomly had this on my CZcams homepage and it's perfect! Love this video. Definitely going to try and write some cute little dogs that'll watch my clipboard for some magic later!
once the file is written, the inotify_event watch descriptor is changed, so furthur access or "alterations" of the file won't be notified. also would be neat that if the file were moved, it would show the path it was moved to. btw nice video, the channel will blow up at this rate
@@hoff._world your code from pastebin has the same issue. mayb some platform dependency? im on arch6.7.3+dwm with dunst notify daemon. watch descriptor is being set to IN_MOVE_SELF rather than IN_MODIFY upon modification of the file. i guess when modifying the file it interprets it as "moving" the file, on my system.
@@johntully1414I have actually noticed that if you use vim to edit it generates move events for some reason. Every other editor I've tested doesn't have the issue so no clue why
@@hoff._world yupp, that was it. looks like the vim/neovim saving mechanism uses "swap" or "temporary" files, so when you're modifying the file in the text editor it writes to the temp file (like a buffer) rather than the original file. Then when you :w the file, it renames that temp file to the original filename.. hence generating move events.
You are running it as a regular shell process, can you please make a video on how to run it as actual daemon which can be controlled by systemctl command
Around 34:00 you might want to assure you read at least _(sizeof *watchEvent)_ bytes too, or else you risk accessing invalid buffer content that wasn't actually filled by _read._ It can be done by changing "bufferPointer < buffer+..." to something like "bufferPointer+(sizeof *watchEvent) < buffer+..." in the _for_ condition. Remember the _read_ system call may return less that you ask for, and even 0 bytes!
Hello, after testing with "bufferPointer+(sizeof *watchEvent) < buffer+..." in the for condition, the inotify event is not detected at all. I think adding the actual size of the struct inotify_event could lead to skipping the loop.
@@Ozla102 Yes, but that probably means you have read a few bytes from the file descriptor ("event queue"), but not yet the full size of a watchEvent. Did you check the actual value of that _readLength?_ Then we're also left with another challenge; how to handle whatever data is left in the buffer after the _for_ loop. (The _bufferPointer_ may even point beyond the end of the data read!) You cannot just discard it, because then all the subsequent reads will be out of sync with the event records, and it can be hard to get back in sync again. Probably just move it to the beginning of the buffer and let the _read_ append from there. This requires some adjustments to both the max count to read and the returned _readLength_ though. Some mgmt related to the variable length of the records too, so a bit of things to get right there, unfortunately!
Nice vid, one thing tho. When writing in C be very careful with `str*` functions. `strlen` is not safe bcs with a string not null-terminated it accesses memory beyond the buffer. You could use strnlen, or better yet, strnlen_s. Nice vid regardless :) cheers
You are right my friend. Considering we are grabbing the string from argv I am trusting the shell to get it right, but on any other user input that is the way to go :D
31:00 Back in the days this was even how we could read directory entries on a *nix system, because as we know "everything is a file" and even a directory could be "open"-ed like one! A terrible non-portable way of doing it, and totally bound to the internal format of one specific file system. IIRC it probably was on a Venix machine I did this.
hey thanx for the great video (subbed)! Been trying to get back into C ever since I was forced to adopt Java (OOP) to get thru my classes at uni (comp sci major) and this video was a great help. Looking forward to enjoying more of your content and seeing where you take this very cool channel 🙂 I do gotta say though... PLEASE make the font in your text editor bigger in future videos! It will make your content WAY easier to engage with going forward (especially for those of us who generally watch YT on a tv screen as opposed to a laptop screen). Anyways that's my only complaint tho - keep up the good work!
don't stress bro font size will be bigger on the next one! Interesting point about the TV screen, hadn't thought about that before. Thanks for the comment!
Starting my journey in tutorial series, after started watch the last tutorial and not understand anything 😂. It is me, not you. You explain very well and is funny, my problem is keep my mind in english and keep my focus on code 🤣 Let’s go!
This was a really good video. It would have been nice if you had included the part where the daemon detaches from the parent shell and runs in it's own session, and all the logs being written to a separate file. It would also be fun to see how to integrate the daemon with systemd and allow it to be started or stopped from there
I like this. Pretty cool :v Edit: I'm a scholar in a research group and watchdog sounded familiar. Maybe youtube recommended this to me because of it. IDK. But anyway, thanks. Now ik what a watchdog is :v
No one going to talk about how he is using Kate to write all this? People crying over why VsCode/Vim/Emacs are the best, meanwhile mans been chillin with Kate watching the world bun, Is he a psycho?
Your cam is in the way of the terminal. I suggest to pipe your webcam output to MPV so that it show in your screen and you can move it around like a normal window.
Thanks, useful video. To get it to build correctly I needed to change the order of the gcc command line in Makefile. ``` CFLAGS= -Wall -pedantic -std=gnu99 all: rolexhound rolexhound: gcc $(CFLAGS) rolexhound.c -o rolexhoundd `pkg-config --cflags --libs libnotify` ```
@ihavenoenem1es it's light and responsive while having the features I want (split view, inbuilt term, LSP client, etc) vs. vscode which feels slow. Also integrates nicely with my DE which is plasma since kate is a KDE editor
Amazing, I already know all this, and I use arch btw, but, still a nice thing to watch in background! Respect for not using VSCode, but I wish you used Vim
Yeah I use vim on the CLI but with this syscall API vim wanted to generate file move events which was really weird, that still works correctly for the intent of seeing if someone edited ur file ig but nano generated the events one would expect so I used that for the demo.
10:45 - One quick thing, I'm not sure if you've mainly done a lot of programming in C++ or something but, in C it's redundant to cast the return value of malloc (or its derivatives). C is very loose about its types and all pointers are really just the same type (void*) when interacting with one another.
Any good books or tutorials on this? I have a python and JavaScript background and will eventually be taking computer science classes. Wanted to learn C. I know the basics of assembly x86. I was having a hard time really understanding what’s going on with the API
damn. only watched first five minutes and already got agitated and intrigued. will watch this for sure. like your delivery. any chance you have discord channel or smth? you seem like a great guy to talk with
Hey, you can also use glib's gio component for file monitoring. glib is included with almost any linux system since it's a gtk dependency (and as you know gtk apps are very common)
@@hoff._world assembly language allows you to pretty much directly manipulate the CPU and all its registers. C obfuscates a lot of that to make it more human-readable.
This video was grt, i also want to learn all these stuff, any advise from where can i learn these low level stuff? i cant find any system engineering playist on youtube
Bro really be coming up to Tony Hoare - rocking variable declarations at the top of his functions like it's the ANSI C days (as if the flexible array members aren't from C99) - telling him that his billion dollar mistake is fine actually and that the legend himself has a skill issue XD fr tho, nullability is useful, that's why you got `Option`, so you get it only where you need it, oh and it's useful for more than just pointers
@CJ1337HF this is true, however if the daemon is started before your desktop env this can cause issues initialising with libnotify. May have to do some playing around, or it might just work, idk hahaha
My girl at the time, ex-girl now :P It was a simple Python web-scraping daemon that sent her a notification when a very niche store (no email notifs) had some piece of clothing she wanted back in stock. She ran Manjaro for around 4 yrs but recently swapped it back to Win when it had some issues.
That is true, and equivalents exist in almost all langs. However string tokenisation is a very common thing in programming in general so I thought it would be good to go over it using this as an example :)
Can somebody help with implementing this watchdog on MacOs? I tried to find libraries, there seems to be a fswatch, but i actually do not know how to properly perform linking. I would really appreciate if somebody had me pushed in some direction here. Thank you very much! Tutorial is great!
@@hoff._worldwhat a legend i know this has some security implications, is there now a way around this to hide your program from inode calls? or is this bulletproof
Dude we’re like the same age but you’ve gotten further than me in c.. and I started programming 6 months ago :( Im slow lol Also BROO WANNA SURF YOU DOGGY 👊 🤣 Love from 🇿🇦 SA
Don't sweat it dude I've been programming for a lot longer than 6 months, that's actually a pretty short amount of time when it comes to getting good at this stuff. Yeah man tell me which beach u wanna hit up and I'll be there sunrise
Letter's to small to watch it from the bed, lucky for me today I'll sleep on the desk 🍻 Cool code and walk true!!! Is really solid. What's the prep/improvise ratio? I love to learn C... I should start with it when I've know nothing, now it's harder. What's worry me, why all of it have a perfect sense for me? I don't understand that!!! I just seen artifacts of it in so many places of my os.
Hey thanks for the comment! As mentioned I did write up the program beforehand, took maybe 20-30 minutes? It is quite a basic program; whatever I improvised in the video would come out roughly the same as what I wrote beforehand. I don't film with scripts, at best I have a text file with some dot points which just feels more natural to me. Tbh I think I'm still a bit robotic in places so trying to work on it. C as a language is nice to learn because you can really start to think like a computer. Higher level languages abstract a lot of things away from you, so when you program in C it's like you're having a conversation with the CPU :)
@@hoff._world you do have a good presentation skills, this is something I'm trying to stress myself a bit more. Half scripted? You are good natural. Keep it this way. C... I know... I'm just lazy fuck, sticked with those languages that are doing for us every stupid mistake... and BTW most of new CLI apps do not provide man 🫨 they are 12 fucks apps and forgetting about first one. fuck!!!! RTFM
mentioned in another comment that because this daemon runs forever the OS will release it when it is killed; there is only one allocation so it will never grow. You could implement a signaling method to the main loop to free the memory before the daemon exits but that would be way too complex for this vid, and pointless because it is about to exit where the kernel will just do it.
Yo fontsize too small dawg
Just use a magnifier application bro 🔍🔍
use something other than a tiny ass phone screen to watch a c programming tutorial dawg
Use magnifier dawg
@@hoff._world i am using a magnifier..
but it cuts off your beautiful face....
@@vaisakhkm783 😳😳😳
why is tommy innit writing linux daemons
Secret second channel my brother
This was my exact reaction lmaoo
My first thought
tommy.init
Tommy SystemD
You are patient and easy to follow. Please please…whatever you do…keep this style. You rock!!
Appreciate it my friend will do
Great video. Perfect amount of being informative/educational without dragging your feet, and you come up with a practical piece of software by the end of it. Very well done, hope to see more from you!
So glad to hear you liked it mate. Cheers!
Probably the best C video Ive ever watched.
Better than most professors out there, very easy to follow and listen too!
in 20 years I'll be one watch
Glad to see young folks using a real operating system
I spent a few hours trying to solve the dependency problem that other people had in the comments. Apparently there are some dependencies that he uses in the video that other distros don't have by default. What I did was install these dependencies with "sudo apt-get install libgdk-pixbuf2.0-dev" and "sudo apt-get install libglib2.0-dev" and installed the libnotify dependency too, but I dont remember the command anymore. Then I ran the build command as follows: "gcc -Wall -pedantic -std=gnu99 -o build/rolexhound rolexhound.c $(pkg-config - -cflags gdk-pixbuf-2.0 libnotify) -lnotify".
Also, I changed the $PKG_CONFIG_PATH environment variable, but I don't know if that helped in any way. It only worked like this on Ubuntu, I hope it works for you too!
Will watch this tonight in bed, high as a kite! Keep it up :D
A good way to watch it :D thanks!
The kids are gonna be alright
my generation aint ruined yet :D
This is so helpful, I've been learning system programming recently. I've wanting to write a battery demon, thanks to you, I now know where to start.
How good, let me know how it goes!
Just discovered your channel. Really good stuff. (aside from the small font size)
I'm guessing small font size might become a running joke here
very well made video from such a small channel. i can see you growing drastically in the future
It means a lot, appreciate it mate. I like your Uncle Iroh pfp
This cunts a legend bro, keep up the work cuzzy. Showing your knowledge without going through at 100x speed and still having a sense of humour and normality about ya
(Sorry for bad language, am from Australia is normal here hahahaha😂😂😂😂)
Mate literally same dont worry about it ya dog. Cheers for your comment
This was a cool video on daemons. I've been looking for good resources all morning and this was the best introduction to getting started with it all. Thanks for the video! :D
Just got recommended this channel today
Thanks for tuning in my friend!
Great video man! About a month ago I wrote a daemon in Zig also using inotify, although just to be fancy and learn I decided to use io_uring instead of actively polling events.
that's awesome bro Zig looks like a sweet lang just haven't had the time to learn it. How does io_uring work without polling? Does it emit signals, events or something your program can write handlers for?
@@hoff._world You tell the kernel to do IO operations (read, write, readv, writev, etc...) and letting it do them when it has time and tell you when they're ready, making them asynchronous. In the end you only have to check if the "completion queue" has any items in it, if not, your application continues as normal. It's a little overkill for a little program like this but it was interesting getting to work with it.
@@michaelscofield4524 sick thanks for sharing. In essence then you're doing a non-blocking check somewhere in your main loop and if that turns negative your daemon does other work until it's ready. Which is useful for bigger daemons for sure, especially if networking is involved where it could potentially talk to others as well (we might be doing that sometime :)
Awesome video man. Learned a ton. You got another sub here. Love to see systems related C videos. Can't wait for more!
Systems programming is one of the coolest things to me. Glad you think the same!
Dude, you just earned yourself another subscriber, nicely done! Keep it up.
this video is insanely goated
Your style is very informative. Kudos!
Glad to hear it!
bro is keeping up with the 10 new years resolutions
Bro u know we arent gonna quit after the first three weeks :DDD
Nice channel, subscribed! But small remark, please next time make your font at least twice the size 🙂 cheers from Poland!
Will do, thanks for your comment!
clear explanation. easy to follow. good intro video in general. thanks for posting this!!!
Randomly had this on my CZcams homepage and it's perfect! Love this video.
Definitely going to try and write some cute little dogs that'll watch my clipboard for some magic later!
Awesome glad to hear you've got some ideas :)
Writing a daemon for a girl is unfathomable rizz
what can I say girls love guys who can speak multiple languages (Japanese, Spanish, C, python, C++, Javascript...)
once the file is written, the inotify_event watch descriptor is changed, so furthur access or "alterations" of the file won't be notified. also would be neat that if the file were moved, it would show the path it was moved to. btw nice video, the channel will blow up at this rate
when I test it multiple modifications work fine, not sure what's going wrong for you. Thanks for your comment!
it happens to me too, not sure why
@@hoff._world your code from pastebin has the same issue. mayb some platform dependency? im on arch6.7.3+dwm with dunst notify daemon. watch descriptor is being set to IN_MOVE_SELF rather than IN_MODIFY upon modification of the file. i guess when modifying the file it interprets it as "moving" the file, on my system.
@@johntully1414I have actually noticed that if you use vim to edit it generates move events for some reason. Every other editor I've tested doesn't have the issue so no clue why
@@hoff._world yupp, that was it. looks like the vim/neovim saving mechanism uses "swap" or "temporary" files, so when you're modifying the file in the text editor it writes to the temp file (like a buffer) rather than the original file. Then when you :w the file, it renames that temp file to the original filename.. hence generating move events.
Thanks a lot! So glad I found out your channel.
Keep it up, greetings from Brazil.
thanks for hosting that CS major in rio
You are running it as a regular shell process, can you please make a video on how to run it as actual daemon which can be controlled by systemctl command
Around 34:00 you might want to assure you read at least _(sizeof *watchEvent)_ bytes too, or else you risk accessing invalid buffer content that wasn't actually filled by _read._ It can be done by changing "bufferPointer < buffer+..." to something like "bufferPointer+(sizeof *watchEvent) < buffer+..." in the _for_ condition. Remember the _read_ system call may return less that you ask for, and even 0 bytes!
True thanks for the note. I suppose the lesson to learn is that good programming requires trust issues :P
Hello, after testing with "bufferPointer+(sizeof *watchEvent) < buffer+..." in the for condition, the inotify event is not detected at all. I think adding the actual size of the struct inotify_event could lead to skipping the loop.
@@Ozla102 Yes, but that probably means you have read a few bytes from the file descriptor ("event queue"), but not yet the full size of a watchEvent. Did you check the actual value of that _readLength?_ Then we're also left with another challenge; how to handle whatever data is left in the buffer after the _for_ loop. (The _bufferPointer_ may even point beyond the end of the data read!) You cannot just discard it, because then all the subsequent reads will be out of sync with the event records, and it can be hard to get back in sync again. Probably just move it to the beginning of the buffer and let the _read_ append from there. This requires some adjustments to both the max count to read and the returned _readLength_ though. Some mgmt related to the variable length of the records too, so a bit of things to get right there, unfortunately!
Nice vid, one thing tho. When writing in C be very careful with `str*` functions. `strlen` is not safe bcs with a string not null-terminated it accesses memory beyond the buffer. You could use strnlen, or better yet, strnlen_s. Nice vid regardless :) cheers
You are right my friend. Considering we are grabbing the string from argv I am trusting the shell to get it right, but on any other user input that is the way to go :D
glibc doesn't implement annex K functions as far as I'm aware
@@Zeutomehr correct for like 99% of them I remember there is small number of exceptions but don't recall which
Dear Linux Daemon,
[your message]
Sincerely yours,
[your name]
Saved you 50 minutes
Funnily enough im gonna do a video talking about how daemons can talk to each other over the network..... they will be doing exactly this :PP
super cool video! i wish you could show us your customized KDE
Cheers for the video idea. Years and years ago I showed it off on r/unixporn but it may be time for an update :)
Uses kate? Absolute chad, you earned my like. I love kate as a replacement for nvim/helix.
kate is just too comfy
31:00 Back in the days this was even how we could read directory entries on a *nix system, because as we know "everything is a file" and even a directory could be "open"-ed like one! A terrible non-portable way of doing it, and totally bound to the internal format of one specific file system. IIRC it probably was on a Venix machine I did this.
It is one of the most powerful and yet most dangerous things about a UNIX system I would say hahaha
You are doing great job, keep it up!
hey thanx for the great video (subbed)! Been trying to get back into C ever since I was forced to adopt Java (OOP) to get thru my classes at uni (comp sci major) and this video was a great help. Looking forward to enjoying more of your content and seeing where you take this very cool channel 🙂 I do gotta say though... PLEASE make the font in your text editor bigger in future videos! It will make your content WAY easier to engage with going forward (especially for those of us who generally watch YT on a tv screen as opposed to a laptop screen). Anyways that's my only complaint tho - keep up the good work!
don't stress bro font size will be bigger on the next one! Interesting point about the TV screen, hadn't thought about that before. Thanks for the comment!
Starting my journey in tutorial series, after started watch the last tutorial and not understand anything 😂.
It is me, not you. You explain very well and is funny, my problem is keep my mind in english and keep my focus on code 🤣 Let’s go!
best of luck with it my guy I know they're quite the elephants to take on :D
This was a really good video. It would have been nice if you had included the part where the daemon detaches from the parent shell and runs in it's own session, and all the logs being written to a separate file. It would also be fun to see how to integrate the daemon with systemd and allow it to be started or stopped from there
There have been a few requests for something like that. I may do a follow up in future :D
11:33
holy jump scare
KEEP POSTING THESE, VIDEOS LIKE THESE THAT ACTUALLY EXPLAINs ARE KINO
Thanks dude appreciate it, will keep it real
I like this. Pretty cool :v
Edit: I'm a scholar in a research group and watchdog sounded familiar.
Maybe youtube recommended this to me because of it. IDK.
But anyway, thanks. Now ik what a watchdog is :v
not watching yet, but commenting to boost the algorithm. I'll give this a try in a bit!
whatever you did worked mate thanks a million :)
the only problem is if you want a better tutorial vid u can change your font size to bigger bro. Appreciate your work bro. Keep up the good work
u got it boss, thanks
How to handle pressure in Scrum Sprints as a developer
No one going to talk about how he is using Kate to write all this?
People crying over why VsCode/Vim/Emacs are the best, meanwhile mans been chillin with Kate watching the world bun, Is he a psycho?
Yep clinically diagnosed with Kate enjoyer disorder
Your cam is in the way of the terminal. I suggest to pipe your webcam output to MPV so that it show in your screen and you can move it around like a normal window.
Yep I noticed that after recording... Rookie error by me not being aware of where it is sometimes. Thanks for the suggestion I'll have a look.
@@hoff._world glad to help
Thanks, useful video.
To get it to build correctly I needed to change the order of the gcc command line in Makefile.
```
CFLAGS= -Wall -pedantic -std=gnu99
all: rolexhound
rolexhound:
gcc $(CFLAGS) rolexhound.c -o rolexhoundd `pkg-config --cflags --libs libnotify`
```
TY for live coding C!
if u liked this video ur gonna have a fun weekend keep an eye out
based kate editor
kate chads rise up from the ashes of the vim vs emacs war
Kate is a great notepad alternative. I use nvim for coding but kate is nice for one offs and pair programming.
@ihavenoenem1es it's light and responsive while having the features I want (split view, inbuilt term, LSP client, etc) vs. vscode which feels slow. Also integrates nicely with my DE which is plasma since kate is a KDE editor
i love this content! thank u for blessing us
bless u
Pretty good man :) Thanks for the nice and well exaplained tutorial :)
dont sweat it!
utube algo in work, recommended your awesome vdo
This guy writes code in Kate. Subscribed.
When anyone talks shit about it I just say "Let me guess, you need more?"
Amazing, I already know all this, and I use arch btw, but, still a nice thing to watch in background! Respect for not using VSCode, but I wish you used Vim
are we seriously still doing this editor war shit 😭
Yeah I use vim on the CLI but with this syscall API vim wanted to generate file move events which was really weird, that still works correctly for the intent of seeing if someone edited ur file ig but nano generated the events one would expect so I used that for the demo.
10:45 - One quick thing, I'm not sure if you've mainly done a lot of programming in C++ or something but, in C it's redundant to cast the return value of malloc (or its derivatives). C is very loose about its types and all pointers are really just the same type (void*) when interacting with one another.
I just prefer to do it so I explicitly always know what I'm dealing with, more of a 'best practice' then for any functional reason.
Any good books or tutorials on this? I have a python and JavaScript background and will eventually be taking computer science classes. Wanted to learn C. I know the basics of assembly x86. I was having a hard time really understanding what’s going on with the API
ill do some kinda vid on it
Defo enjoyed this. Good on ya!
Thanks mate appreciate it!
Great channel, deserves more subs.
Er well it certainly did that the last day and a bit. Thanks!
Thumbs up just for the thumbnail x)
Earned a subscriber.
Thanks for making this! :D
12:04 use strrchr(argv[1], '/'); to find the pointer to the last slash instead of a strtok() loop.
As long as you remember to ignore any trailing slashes first.
damn. only watched first five minutes and already got agitated and intrigued. will watch this for sure. like your delivery. any chance you have discord channel or smth? you seem like a great guy to talk with
Hey thanks! Might make a discord server if the channel grows and there's interest
great tutorial, subbed
This is my Internet, get your own.
hahaha , got you
@@masoom-theproudvegan7212 :)
hello dr.
@@mrinalyadav4261 Hi there
thanks, really cool
Hey, you can also use glib's gio component for file monitoring. glib is included with almost any linux system since it's a gtk dependency (and as you know gtk apps are very common)
True, and with this daemon if you have libnotify you also have GTK. Good note!
Insane man. I am a big fan of native development in Rust. Would be awesome if you have videos on it too.
unfortunately rust is not among my repertoire, more of a C and Golang enjoyer. I have heard very good things about it though, may learn in future!
Great got me interested planing on making my own
Glad to hear it write back with what you come up with!
Programming in C scratches an itch no other programming language does
to me it is like you are having a one-to-one chat with the CPU
@@hoff._world assembly language allows you to pretty much directly manipulate the CPU and all its registers. C obfuscates a lot of that to make it more human-readable.
@@bimmy4664 yes, if you think about it the entire field of computer science is about smart abstraction
You're a clever young man!
enlarge the font please in your further videos for better visibility. thx
Thanks for your feedback. Will do!
No way! I actually understood the thing. This is epic! Dont be yoo silly btw
Thanks. I'll try not to be too silly but I'm just such a funny little character aren't I
Excellent. Thanks.
This video was grt, i also want to learn all these stuff, any advise from where can i learn these low level stuff? i cant find any system engineering playist on youtube
Great video! Subscribed
Legend mate thanks!
Great video mate
Cheers goon man
Would have been badass if by end of video he looked omega stressed and had a wizards beard.
I do, but internally, internally
A lot of the cstdlib is implemented via syscall in unix like systems...
Bro really be coming up to Tony Hoare - rocking variable declarations at the top of his functions like it's the ANSI C days (as if the flexible array members aren't from C99) - telling him that his billion dollar mistake is fine actually and that the legend himself has a skill issue XD
fr tho, nullability is useful, that's why you got `Option`, so you get it only where you need it, oh and it's useful for more than just pointers
yeah my friend I'm young and arrogant ofc I know better than Tony :P
just needed a help , libnotify and glib gives no file found even after i included from source directory of my system of nixos
Why did you not make a service file and load the binary of program in the service file and then start with systemctl
because the video was 50 minutes long 😬
Wouldn't mind it being 1:20 if it tells me everything @@hoff._world
how to set up the daemon to os startup would be nice to see to all this. thanks for video.
Fairly easy via systemd. Just a small config file
@CJ1337HF this is true, however if the daemon is started before your desktop env this can cause issues initialising with libnotify. May have to do some playing around, or it might just work, idk hahaha
@@hoff._world you can solve thus easily by setting the target correctly
I'm a bit curious about the daemon you said you wrote for your girl. What did it even do? Does she run a Linux machine then?
My girl at the time, ex-girl now :P It was a simple Python web-scraping daemon that sent her a notification when a very niche store (no email notifs) had some piece of clothing she wanted back in stock.
She ran Manjaro for around 4 yrs but recently swapped it back to Win when it had some issues.
Legend
You could have used `char *basename(char *path)` to get the basename from the path
That is true, and equivalents exist in almost all langs. However string tokenisation is a very common thing in programming in general so I thought it would be good to go over it using this as an example :)
@@hoff._world you did the right choice as I have never heard of it and now I know. Might be useful someday
Can somebody help with implementing this watchdog on MacOs? I tried to find libraries, there seems to be a fswatch, but i actually do not know how to properly perform linking.
I would really appreciate if somebody had me pushed in some direction here.
Thank you very much!
Tutorial is great!
People at my school didn't even know html, never mind Linux system daemons lol too cool for school 👍
You'll be the 'hacker kid' in school
@@hoff._world lol i'd be Billy Madison ;p
Can you please zoom in when you are typing the code, so we can read it.
Bro please do an advance C course, i love the way you're explaining things. Do you have any courses on udemy?
nah im not a grifter, shit will be up for free dont stress bruv
@@hoff._world right on. font still too small :-D
@thats-no-moon that's the catch, it's free but u pay with ur eyesight
@@hoff._worldwhat a legend
i know this has some security implications, is there now a way around this to hide your program from inode calls? or is this bulletproof
awesome thumbnail
Can this be cross platform with compiler as an enabler ? Asking from title .
nope, we use linux-only system calls in this one
great video! i was thinking, wouldn't an enum be easier for the error codes?
Yeah you totally could. One of the things I love about programming is there are so many different ways to do the same thing :D
Yeah, vid is pretty good, NGL
that boat in ur pfp looks pretty good ngl
W vid
Dude we’re like the same age but you’ve gotten further than me in c.. and I started programming 6 months ago :(
Im slow lol
Also BROO WANNA SURF YOU DOGGY 👊 🤣
Love from 🇿🇦 SA
Don't sweat it dude I've been programming for a lot longer than 6 months, that's actually a pretty short amount of time when it comes to getting good at this stuff.
Yeah man tell me which beach u wanna hit up and I'll be there sunrise
@@hoff._world one day bro 🤣
Letter's to small to watch it from the bed, lucky for me today I'll sleep on the desk 🍻
Cool code and walk true!!! Is really solid. What's the prep/improvise ratio?
I love to learn C... I should start with it when I've know nothing, now it's harder. What's worry me, why all of it have a perfect sense for me? I don't understand that!!! I just seen artifacts of it in so many places of my os.
Hey thanks for the comment! As mentioned I did write up the program beforehand, took maybe 20-30 minutes? It is quite a basic program; whatever I improvised in the video would come out roughly the same as what I wrote beforehand.
I don't film with scripts, at best I have a text file with some dot points which just feels more natural to me. Tbh I think I'm still a bit robotic in places so trying to work on it.
C as a language is nice to learn because you can really start to think like a computer. Higher level languages abstract a lot of things away from you, so when you program in C it's like you're having a conversation with the CPU :)
@@hoff._world you do have a good presentation skills, this is something I'm trying to stress myself a bit more. Half scripted? You are good natural. Keep it this way.
C... I know... I'm just lazy fuck, sticked with those languages that are doing for us every stupid mistake... and BTW most of new CLI apps do not provide man 🫨 they are 12 fucks apps and forgetting about first one. fuck!!!! RTFM
@@hoff._world tbh it did not have a robotic feel to me. It all felt pretty natural.
@mikereynolds1368 cheers Mike that's good to hear
I must notify you allocated memory but failed to release the memory using free(), at the end.
mentioned in another comment that because this daemon runs forever the OS will release it when it is killed; there is only one allocation so it will never grow. You could implement a signaling method to the main loop to free the memory before the daemon exits but that would be way too complex for this vid, and pointless because it is about to exit where the kernel will just do it.
Really cool.
no u