A simple program in C. Do 1 second of CPU work and then exit.
A simple program to do a second of CPU work and then exit. This is very simple but fun to play with.
Read MoreA simple program to do a second of CPU work and then exit. This is very simple but fun to play with.
Read MoreGitHub Copilot is a great assistant when writing programming code for the modern workplace.
Read MoreThis really depends on what kind of job you want, really. Some will require a Bachelor’s and will not look at you without experience. Most will care about the experience over a degree, but your resume will need to be solid so expect to put the time you’d have put…
Read MoreThis is a very simple Hello World program in C. int main() { write(1, "Hello World\n", 14); }int main() { write(1, "Hello World\n", 14); } Counting how long a text string is. #include <stdio.h> #include <string.h> #define MSG "Hello Doctor, let’s get back to the TARDIS!" int main() { int…
Read MoreThe anticipated new game Cyberpunk 2077 has launched and it is not very good at all. There are severe performance issues and it is not very polished at all. That is what happens when developers release a trash game at the set date and then depend upon patches after the…
Read MoreThis is a nice example in C. This will append text to a file whenever it is run. This is the proper way to do this in this programming language. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 #include <stdlib.h> #include <stdio.h> int…
Read MoreThere are various tricks for programming on Linux. One useful trick is to open a file for reading with C. This is how to do this. The “r” option for fopen() will read the file into memory. #include <stdlib.h> #include <stdio.h> int main(void) { FILE *f; char buf[256]; …
Read MoreSome very useful code samples for any C programmer. These might give you some new ideas. Print the time and date with C. #include <time.h> // For time function (random seed). #include <stdio.h> // For extra functions. printf(). #include <stdlib.h> // For getenv(); #define format "The time and date…
Read MoreHow to define a string and print it out with the printf() function. #include <stdio.h> /* Defining a global string. */ #define hi "Hello Sire." int main(void) { /* Printing out the string. */ printf("%s\n", hi); return 0; }#include <stdio.h> /* Defining a global string. */…
Read MoreHere are some useful FizzBuzz programming examples in various programming languages. These might prove useful as code samples that could be expanded into a larger project or just for interests sake. Very useful if you wish to learn how to program, taking these programs apart and modifying them would be…
Read Morehttp://gentoomen.org/tutorials/resources.html. The gentoomen.org resources page. Very good list of links to various tutorials and help pages. http://tldp.org/LDP/abs/html/. The Advanced BASH scripting guide. ftp://ftp.vim.org/pub/vim/doc/book/vimbook-OPL.pdf. The VIM guideboook. http://stommel.tamu.edu/~baum/programming.html. 3000 useful guides to programming and Linux documentation and help pages. http://samizdat.mines.edu/howto/HowToBeAProgrammer.html. How to be a programmer. A short but comprehensive summary. http://www.psychocats.net/ubuntu/index….
Read MoreOpening a folder and listing the contents, and not listing certain files. This is the Perl code I was using on my very old Tripod.com website. opendir(DNAME, "$folder") || die "I cannot open the requested directory $folder \n $!"; @dirfiles2 = readdir (DNAME); @dirfiles2 = sort(@dirfiles2); foreach $x2 (@dirfiles2) {…
Read MoreThis programming trick is pretty cool, you can run the /bin/sh shell with a C program. The execve() function is useful for running a command within a C program and passing arguments to it, but I have replaced the arguments with NULL instead, that is what you put when you…
Read MoreA very obfuscated C program. typedef unsigned char t;t*F="%c",l[]="|\\/=_ \n](.\0(),*(.(=(}*.)[[*.",N=’\n’,* r;typedef(*H)();extern H Ar;Q(a){return(a|-a)>>31;}H S(c,a){return(H)(a&~c|(int )Ar&c);}extern t*ist;V(t*u){*u^=*u&2^(*u>>7)*185;}Z(t*u,t n){*u-=n;}e(t c,H h){ R(h,Q(* r^c));} I(){r=l +7-4*Q( getchar ()^*l); }R(H h, int c){Ar=S (c,h);- main() ;}P(){r ++;}z() { O(&N);} O(t*c){ printf( F,+*c); }T(){r= "This is not a function\n" ;}w(U){ U=Z(r,8 ); r-=~Q(* r/8-4); return…
Read MoreThis code snippet will run the date command. The execl() function is very useful for executing a command within your C program.You replace the NULL identifiers with any extra arguments to pass to the program. I prefer this over the system() function. #include <unistd.h> int main(void) { execl("/bin/date",…
Read MoreThis is a sample C program showing how to define a function as well as accepting input from the command-line. Hopefully this is useful for someone who is writing a console application for Linux or UNIX. #include <stdio.h> #include <string.h> int main(int argc, char **argv) { char *name;…
Read Moreint main() { write(1, "Hello world.\n", 14); return 0; }int main() { write(1, "Hello world.\n", 14); return 0; } Can you think of any simpler C example?
Read More