Using C instead of Bash

  Рет қаралды 41,471

Tsoding Daily

Tsoding Daily

Күн бұрын

References:
- Fixmee extension for Emacs: github.com/rolandwalker/fixmee
- The Start of the Trie project • This Data Structure co...
- Trie Source Code: gitlab.com/tsoding/trie
Support:
- Patreon: / tsoding
- Twitch Subscription: / tsoding
- Streamlabs Donations: streamlabs.com/tsoding/tip
Feel free to use this video to make highlights and upload them to KZfaq (also please put the link to this channel in the description)

Пікірлер: 60
@TsodingDaily
@TsodingDaily 2 жыл бұрын
Look at the video id gachiGASM
@pihnea
@pihnea 2 жыл бұрын
this must be a sign
@ivypierlot
@ivypierlot 2 жыл бұрын
me when i have a gachigasm
@Q_20
@Q_20 2 жыл бұрын
Betudidnexpectet
@qm3ster
@qm3ster 2 жыл бұрын
www.youtube.com/watch?v=gachiGASM
@konstantinrebrov675
@konstantinrebrov675 9 ай бұрын
According to KZfaq this video is not available any more.
@Zwiebelgian
@Zwiebelgian 2 жыл бұрын
"If you let the child go, it will act like a parent" "If child equals 0 that means we are in a child" "First thing you try to do, you try to fork a child, and if you successfully fork the child, you try and execute the child." -Tsoding, 2021
@pitust
@pitust 2 жыл бұрын
lmao
@ractheworld
@ractheworld 2 жыл бұрын
Starts proper then goes south fast.
@Avianable
@Avianable 2 жыл бұрын
In vim, you can just press ctrl-x on a number and it will decrease its value automagically :)
@dmitry.shpakov
@dmitry.shpakov 2 жыл бұрын
And ctrl+a increase that number by one.
@mirandnyan
@mirandnyan 2 жыл бұрын
and emacs has a package for that too (not to start a fight, I use both)
@alessandroias
@alessandroias 2 жыл бұрын
I thought he switched to vim... didn't he?
@otesunki
@otesunki 2 жыл бұрын
@@alessandroias ngl it looks like evil emacs
@geoffl
@geoffl 2 жыл бұрын
ctrl+a for opposite direction
@10e999
@10e999 2 жыл бұрын
I really like your C programming stream. Your good at explaining the thinking behind the code. Thanks for your work.
@janeriklofflat8039
@janeriklofflat8039 2 жыл бұрын
"Not all of my recreational activity is actually watchable." Not if you don't switch your platform.
@technologicalwaste7612
@technologicalwaste7612 2 жыл бұрын
The documentation plugin looks very convenient. Each time I watch one of your videos, I am given the impression that my setup is relatively deprived. You appear to have every potentially useful resource hot-keyed.
@TheLordoftheDarkness
@TheLordoftheDarkness 2 жыл бұрын
28:07 That's me with the const keyword. When I try to do things half good with const, I end up with lots of compilation error until I say "fuck it" and unconst everything.
@mathalphabet5645
@mathalphabet5645 2 жыл бұрын
This was awesome lecture.
@venkateshhariharan4341
@venkateshhariharan4341 2 жыл бұрын
nice video, it helped me to learn a lot thanks
@PizzaGamingTheReal
@PizzaGamingTheReal 2 жыл бұрын
For checking if execvp was OK or not you can even avoid writing if statement and check for -1, because if everything was OK it will not move to the next line, cause the process will be changed and if something went wrong then it will continue. So you could write something like this: execvp(argv[0], argv); error(...); function which also exits with a non-zero status code.
@alh-xj6gt
@alh-xj6gt 7 ай бұрын
That scratch buffer is very neat, feels useful, more sane and better compared to whatever I was doing with strcat() and realloc()s. 56:47 memcpy reading from empty string is as far as I understand it undefined behaviour, instead would add a function like: char *tmp_append_null(void) { char *result = tmp_alloc(1); memset(result, 0, 1); return result; } This communicates the end a bit better. Also with a few rewinds deep they are nice to jump to and make sense of what is happening. Just to be safe. char tmp[TMP_CAP + 1] = {0}; For when the entire TMP_CAP range might be filled so it still terminates with 0. Played with tmp_rewind() a bit more it will block the current concatenation. Found it useful for debugging to flag functionality into the rewind that memset()s with specific char per rewind called. In the example used base64 as 64 different tmp_rewind()s till a tmp_clean() seems more than enough? As more seems a bit excessive? But this way stepping through it and showing memory helps a bit to make sense on rewinds used nested or used in loops. // . . . #define RW_DEBUG #ifdef RW_DEBUG char rw_b64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; short int rw_tally = 0; // tmp_clean() resets to 0 char rw_pad(){ assert (rw_tally+1 < 64); // more than 64 rewinds deep till a tmp_clean() is a bit much? return rw_b64[rw_tally++]; } #endif // RW_DEBUG // . . . void tmp_clean() { #ifdef RW_DEBUG rw_tally = 0; // resets rewinding tally #endif tmp_size = 0; } // . . . void tmp_rewind(char *saved_end) { #ifdef RW_DEBUG { char * p_to_end = tmp + tmp_size; size_t rewind_region = p_to_end - saved_end; memset( saved_end, rw_pad(), rewind_region ); printf(" [RW_DEBUG] Rewind fill: %s ", saved_end + 1 ); } #endif tmp_size = saved_end - tmp; }
@greob
@greob 2 жыл бұрын
Pretty cool!
@Skulltroxx
@Skulltroxx Жыл бұрын
man I don't understand shit, but still keep watching
@h3xad3cimaldev61
@h3xad3cimaldev61 2 жыл бұрын
24:53 don't know how he said it with a straight face
@TsodingDaily
@TsodingDaily 2 жыл бұрын
Years of practice
@h3xad3cimaldev61
@h3xad3cimaldev61 2 жыл бұрын
@@TsodingDaily ah yes
@karmavil4034
@karmavil4034 2 жыл бұрын
Quite impressive and very pleasant. I was wondering what else do you have (in case this is not enough) and bang! I need a couple of lifetime vacations of my current unemployment situation to stay up to date (did someone said C). Absolutely wonderful management of time. I don't usually see that much but technically this is unusal
@TheRedbeardster
@TheRedbeardster 2 жыл бұрын
Подскажите, пжл, имя темы для емакса :) Could you tell me , please, the emacs's theme name? Thanks!
@eduardoantunes2958
@eduardoantunes2958 2 жыл бұрын
It's gruber darker I think
@Daniel-hz6pt
@Daniel-hz6pt 2 жыл бұрын
I would love to see you write some kind of client/server application, your insights on memory management especially remote are super interesting, and are the main reasons I avoid C/C++ for remote services
@irenicsuspense
@irenicsuspense 2 жыл бұрын
I was thinking the same thing!
@bratpeki
@bratpeki 2 жыл бұрын
hey tsoding, you're missing a colon on the third line of the description. Lol!
@TsodingDaily
@TsodingDaily 2 жыл бұрын
Check again
@iwikal
@iwikal 2 жыл бұрын
@@TsodingDaily hey tsoding, you're missing a colon on the second line of the description. Lol!
@TimeTravelingFetus
@TimeTravelingFetus 2 жыл бұрын
pull requests be like
@qm3ster
@qm3ster 2 жыл бұрын
Wouldn't calling `tmp_clean()` (or rewind) inside the loop after printf be better? That way each of your arguments can be 8MB instead of the escaped total.
@TsodingDaily
@TsodingDaily 2 жыл бұрын
Sure, you have a lot of flexibility with this approach.
@qm3ster
@qm3ster 2 жыл бұрын
🐴
@33v4.
@33v4. 2 жыл бұрын
This was probably recommended to me because the channel has TS in the name, but no TS in the channel, which is sad. But good content. Big fan
@Control747
@Control747 2 жыл бұрын
Noice video. But where was the intro? I didn't expect no intro. :(
@CaptainWumbo
@CaptainWumbo 2 жыл бұрын
I like the idea that a zero urgency todo is just a Tod. I have 1000s of Tods I will never get around to.
@alexzander__6334
@alexzander__6334 2 жыл бұрын
back to emacs
@oscardeits4709
@oscardeits4709 2 жыл бұрын
Seems wasteful to create / write the dot file to disk. "dot" can read from stdin, which means that if you fork the dot command first (and do the proper pipe duping and closing) you can print your dotfile straight to the generator.
@unforkableonion5081
@unforkableonion5081 2 жыл бұрын
you probably know it, but just in case graphviz is usable as c library too. hope you are fine and smh have still access to the internet. stay safe
@meneereenhoorn
@meneereenhoorn 2 жыл бұрын
I am trailing behind oOoooo. Still on vim, what am I waiting for! Close the windows.
@fennecbesixdouze1794
@fennecbesixdouze1794 2 жыл бұрын
The name "trie" comes from the word "reTRIEval".
@BRLN1
@BRLN1 2 жыл бұрын
"I'am literally copying code from python" ... just alike modern history of c++
@on8t
@on8t 2 жыл бұрын
и ни одного комментария на русском(
@Denis-ez8gd
@Denis-ez8gd 2 жыл бұрын
Hey, thanks for the video. Btw, I really don't like this `tmp_clean()` impl. I am sure, you need to clean the buffer with something like memset, or bzero, even if we are talking about demo purpose... Otherwise someone could copy this code, forgot about the important part and got security problem.
@TsodingDaily
@TsodingDaily 2 жыл бұрын
I think the real problem here is people copying random code from the Internet into security critical applications without thinking, not me just chilling and coding some stuff for fun. I disclaim any responsibility for the actions of such people. Not my problem, sorry.
@Denis-ez8gd
@Denis-ez8gd 2 жыл бұрын
@@TsodingDaily ok, thanks for the response.
@pushqrdx
@pushqrdx 2 жыл бұрын
you can actually add something like this at the beginning of a c file make it executable and it works like a shebang :D #if 0 cc -Wall -Wextra -std=c17 "$0"; exit #endif
@artusartus4540
@artusartus4540 2 жыл бұрын
Yay first
@AndiSteilwandi
@AndiSteilwandi 2 жыл бұрын
Reusing tools and glueing them together via shell script preferred. This is too much effort practically speaking... Aesthetics: What's the point of text mode when using the mouse all the time? Also, consider using vim for efficiency. 👍
Coding a Bouncing Ball in Terminal
1:26:29
Tsoding Daily
Рет қаралды 81 М.
Playing hide and seek with my dog 🐶
00:25
Zach King
Рет қаралды 36 МЛН
CHOCKY MILK.. 🤣 #shorts
00:20
Savage Vlogs
Рет қаралды 10 МЛН
Finger Heart - Fancy Refill (Inside Out Animation)
00:30
FASH
Рет қаралды 29 МЛН
What is Relative Pointers?
1:51:27
Tsoding Daily
Рет қаралды 32 М.
Stealing ideas from other Open Source projects
55:52
Tsoding Daily
Рет қаралды 23 М.
This Data Structure could be used for Autocomplete
1:54:31
Tsoding Daily
Рет қаралды 41 М.
I contributed to C3 Compiler and So Can You
4:15:02
Tsoding Daily
Рет қаралды 46 М.
Hiding Information Inside of PNG
1:53:49
Tsoding Daily
Рет қаралды 48 М.
White Noise Generator in C
2:01:30
Tsoding Daily
Рет қаралды 21 М.
The Boundary of Computation
12:59
Mutual Information
Рет қаралды 992 М.
Inline Functions in C
49:58
Tsoding Daily
Рет қаралды 10 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 1,2 МЛН
Vision Pro наконец-то доработали! Но не Apple!
0:40
ÉЖИ АКСЁНОВ
Рет қаралды 271 М.
Tag him😳💕 #miniphone #iphone #samsung #smartphone #fy
0:11
Pockify™
Рет қаралды 4 МЛН