Post your coding projects

Cool project. What was your reason for switching from php to meteorJS?

javascript full stack development, its much faster than dealing with a lot of seperate languges. As our last project we had 3 people working on it in spare time and it was like 10k lines of code just to do what I can do with meteor in less than 300.

Oh, and our site only have PHP5 on the webserver, and we can't upgrade it, so I wanted something that would give good performance.

1 Like

Most recent project.

Away to visit relatives in another state, got bored and decided to make a roguelike cli game.

2 Likes

This one is for you @Miguel_Sensacion.

Below we have an example of a nasty little "green/red" PHP script written by yours truly, which attempts to automate our site's "Service Status Board," for our fellow non-IT people to know when service interruptions are occurring. We have sweet monitoring, the regular/normal people don't, so they use our service status board. I'll run it as a cron every 3-5 minutes.

Per standard sysadmin procedure, I've made sure to leave all the commented out debugging code and strictly use procedural and function programming to give all the good programmers and devs the full sysadmin treatment.

There is one outstanding tablepress library I need to include, but I'll do that Wednesday when I get back to work and put this into production. Then we'll never have update our status board again, until WordPress releases 4.9 and totally ravages our site again.

Lastly, when things slow down (LOL!) I'll probably write a quick function which actually authenticates into two of the services, because even though the page loads, tomcat listeners sometimes like to stop working and reverse proxies sometimes just don't want to forward traffic. That will be 2.0, for now this is enough for a hacked up script.

Enjoy!

PS - Code written using Vi on an Ubuntu 16.04 Laptop.

#!/usr/bin/php

//THIS SCRIPT UPDATES OUR SERVICE STATUS BOARD

#####################################################################################
#										    #
#				DEFINE FUNCTIONS				    #
#										    #
#####################################################################################


//THIS FUNCTION CHECKS IF A URL IS "ONLINE" BY RETURNING "FALSE" IF THE HTTP HEADERS DON'T RETURN A 200
	function URLIsValid($url)
	{
	//	echo "checking " . $url;
		$exists = true;
		$file_headers = @get_headers($url); //gets headers from url
		$headers = array('HTTP/1.1 200 OK','HTTP/1.0 404 Not Found', 'HTTP/1.0 403 Forbidden', 'HTTP/1.0 500 Internal Server Error'); //array of possible header
		foreach($headers as $headerVal)
		{
	//		echo  $file_headers[0];
			if($file_headers[0] != $headers[0])
			{
				$exists = false;
			}
		}
	
		return $exists;
	}

//THIS FUNCTION ITERATES THROUGH THE SITES AND GENERATES THE OUTPUT FOR THE TABLE
	function runIt($sites, $urls)
	{
		$table_id = 1; //TABLEPRESS TABLE NUMBER ID
		$table = TablePress::$model_table->load( $table_id ); //LOAD THAT TABLE INTO MEMORY

		$numDown = 0; //HOW MANY SERVICES DOWN
		$i=0; //COUNTER
		$pattern='/^man|^unknown|^degraded/'; //MATCH PATTERNS WHICH INDICATED WE'VE MANUALLY UPDATED THE STATUS
		
		//LOOP THROUGH EACH URL		
		foreach($urls as $url)
		{
	//		$friendlyName=$sites[$url]; //TEMP ASSIGN THE FRIENDLY NAME FOR THE URL
			$trValue=table[data][' . $i . ']; //GET THE HTML TAG FOR THIS ROW
	//		$trValue="<span class = \"ok status\">OK</span>"; 
			
			//IF WE'VE MANUALLY UPDATED THE TABLE DON'T MESS WITH IT OTHERWISE PROCEED TO UPDATE TABLE
			if (!preg_match($pattern, substr($trValue,15), $matches))
			{
				if (URLIsValid($url))//SEE IF WE'RE UP
				{
	//				echo $friendlyName . " is up \n";
					table[data][' . $i . '] = "<span class = \"ok status\">OK</span>"; 
			//		echo "\n";
				}
				else
				{
			//		echo $friendlyName[$i] . " is down \n";
	       		 		table[data][' . $i . '] = "<span class = \"do status\">DOWN</span>"; 
			//		echo "\n";
					$numDown++;
				}
			
			}

			$i++;
		}
		
		//GET THE VALUE OF THE NETWORK ROW	
		$trValue=table[data][' . 5 . '];
//		$trValue="<span class = \"ok status\">OK</span>"; 

		//IF WE'VE MANUALLY SET IT LEAVE IT ALONE
		if (!preg_match($pattern, substr($trValue,15), $matches))
		{
			if($numDown == 2)//IF TWO SERVICES ARE DOWN THE NETWORK IS LIKELY DEGRADED
			{
	        //		echo "Network degraded \n";
	         		table[data][' . 5  . '] = "<span class = \"de status\">Degraded</span>"; 
			}
			else if ($numDown > 2)//IF MORE THAN TWO ARE DOWN THE ISP IS PROBABLY DOWN 
			{
		//		echo "Network Down \n";			
	         		table[data][' . 5  . '] = "<span class = \"do status\">Down</span>"; 
			}
			else
			{
		//		echo "Network Okay \n";
	        		table[data][' . 5  . '] = "<span class = \"ok status\">OK</span>"; 
			}
		}		
	
			TablePress::$model_table->save( $table ); //UPDATE THAT TABLE
	}
		
//DEFINE MAIN
	function main()
	{
		//Hashmap of our sites
		//Order is important here so make sure you put them in the correct or they appear on the table
		$sites=[
			"http://www.companyhomepage.com" => "Company_Site",       //Company's Webpage
			"https://mail.company.com"=>"Email",                      //Email
			"https://application.oursite.com"=>"Hosted_App1",         //Hosted App1
			"https://emportal.oursite.com/lolz"=>"EmployeePortal",                 //Employee Portal
			];

		//GET JUST THE KEYS FROM ABOVE
		foreach($sites as $key => $value)
		{
			$urls[]=$key;		
		}	
		
		//BUILD THE TABLE
		runIt($sites, $urls);
	}


#######################################################################
#								      #
#                           SHOW TIME				      #
#                                                                     #
#######################################################################


main();


//AND.....WE CAN ALL GO HOME NOW
1 Like

Well i don't have anything to present here at this point but there are two things I am working on in coding.
Nr1: For a school end of year kind of project we are recreating the game 2048 in Javascript.

Nr2: For a project in cooperation between my school and tente, a company that is developing a motorized tire for hospital beds to ease the workers in a hospital and to enable a single person to move a heavy bed more efficiently. For this project we are just writing code. All contributors from our school get a free raspberry pi and if we do good work we get a job offer. However this second project didn't properly start yet.

1 Like

At the suggestion of @MFZuul:

I pulled the DictDiffer class from somewhere on the web, as well as a template for sending email, so not all original, but nonetheless, useful.

3 Likes

I'm making a C++ bioinformatics library, and am using it to rebase for version 3 of TF-Cluster. Granted, soon TF-Cluster and TF-Finder will both die off as they are absorbed (rightfully so) into orange.

github.com/anadon/madlib

There's a non-0 chance that I might accidentally DDOS NCBI from the new TF-Cluster version, though...

1 Like

added a thing to say if it completes over 10k for finalizing a list file for the mcli program..

added a higher retry allowance for failing to open a file before mserv will just drop back to the low power/wait state.
was previously 10 tries as fast as possible, now its 10 tries, then 1 second delay, upto 10times.

also changed mserv, so it fully doesnt create position files for lists which only have 1 segment(as theres no position to differentiate), instead of them previously being temp files.

the position tracking is such that it gets updated every time it finishes playing a segment, as depending on how the user sets up the thing the potential for dataloss could be pretty high, if there was an unexpcted shutdown, powerloss etc.

as, if you have a list thats say 25k segments, of ~25m episodes or ~434days if they just left it running 24/7 the probability of powerloss or something like that within the time of playing the list 1 time is probably guaranteed. by writing every time the only way you could lose data from say powerloss, would be if it happened during the write, which is a tiny fraction of the time for a small single block file vs say 3m for a music video, or 2hrs for a movie whatever, otherwise it will resume on the same segment

otherwise still looking into optimization for if the lists become very large

is currently single threaded but dont think thats the issue is the scanning in of the data for the individual segments using only a single pointer, such that it has to rescan files many many times but cant really just use the novell solution of using one pointer per file as, not all operating systems may be cool with you just potentially opening up say anywhere between 1 and something billions of pointers

currently thinking of some kinda indexing/see if theres some other ways i can advance through the files.
ex: if did once thte total for the list goes over 1000 say, create a subdir, and have 1 file per 1000 which would substantially improve it over having lists 5-10000> long, which is pretty high candidate currently just looking into some other options first :stuck_out_tongue:

@SEP @MFZuul

2 Likes

Wrote a small package which implements a template string tag that can be used to write SQL queries from Javascript in a fairly succinct way. Automatic prepared statements...

JESUS

OH

ow...

I made a website for my database class using PHP and MySQL (mariadb version).





My last project was text editor plank. I decided to halt it, because I am doing something more interesting.

Introducing:

FermiOS

This "state of the art" "Operating System" has such amazing and revolutionary features as:

  • receiving input from PS/2 keyboard (and USB because of hardware emulation);
  • printing text on CGA compliant graphics monitors (and other because of hardware emulation);
  • it has a timer.

It's stylish white on blue all text UI will set the standards for millennia into future. It will transform your IBM compatible PC with Intel i386 or better compatible CPU into... into... magnificent post-modern art piece.

Here you can see our engineer use it:

And you just wait and hear what people say about it:

"So, can I type ls? No? Oh, it doesn't have HDD support, yet? Cool..."
-My Dad


Anyways, it's in C + some x86 assembly sparkled here and there. Here's the repo: https://bitbucket.org/redpandaua/fermios


You asked for it @dinscurge

3 Likes

I'm gonna have a look at your creation :smiley:
But a question. Where do you start if you want to do something like this?

Hello fellow Operating System developer!

I'm also working on an i386 (with plans for x86_64, arm) OS. Mine's written in C/Asm and doesn't really do much, but also has PS/2, VGA, Timer, and an ext2 driver which I'm almost done writing.

It also has paging support as well as a full kernel memory manager!

Once I finish the ext2 driver I plan on adding ATA support (probably PIO mode for now) and then I'll move on to userspace.

I plan to design it in such a way that systemcalls can be easily swapped per-process so that kernel-level compatibility for other operating systems can be achieved (kind of like Wine, but in the kernel).

The full source is available here under the GPLv3 license.

4 Likes

The OSDev Wiki is an invaluable resource for operating system development. It even has a Bare Bones Tutorial for getting started.

Also, a shameless plug for my tutorial on writing a page frame allocator, once you get to that point.

4 Likes

Dude! Thanks so much for tutorial! Really appreciate this! And nice progress! How hard was to implement ext2 driver? Are you doing VFS atm to test it? Like in RAM?

Also @Eden as Shawn here said, http://wiki.osdev.org/Main_Page is the shit.

2 Likes

Thanks!

I've been working on the ext2 driver on and off for months now. My goal is to have a fully working driver with no shortcuts, so naturally it is taking a long time. I'm writing it as a Linux usermode application because it's MUCH easier to debug with tools like GDB and Valgrind. Once it's fully done, porting it to ShawnOS should be a breeze, since it already has a VFS system.

I'm currently developing it in a separate repository here. Once it's done, I plan on testing it by loading an ext2 filesystem into RAM using Multiboot's module loading, so it'll work similar to an initramfs.

1 Like

Are you doing microkernel? Also POSIX compliant?

It's a monolithic kernel, as I didn't want to spend 90% of the time writing the complex communication mechanisms required for a microkernel.

The kernel itself won't directly implement any POSIX functions (or any other standardized functions for that matter). Instead, it will provide only the basic mechanisms necessary for userspace. Once that's done, I plan on implementing a POSIX systemcall layer as I briefly described above which will use the aforementioned mechanisms. This will allow me to expand it further and potentially even write a systemcall layer for Linux or NetBSD applications to run natively.

1 Like

Rad man, absolutely rad. I want to reinvent as much wheels as possible, so I don't plan on porting any software. So, no POSIX for me, but your idea of userspace translation layer is pretty damn good idea.

1 Like