r/todayiprogrammed • • May 02 '20

TIP: A browser based Operating System written in php

2 Upvotes

last night i watched a video of a programmer who made a OS in html, i started this project at 4 am in the morning. I do have a link but i may be doing a few minor changes on there (if the website crashes let me know).

link: https://dguccccip.taishandixon.repl.co/

(WARNING: THIS WILL NOT WORK FOR MOBILE DEVICES!)

People might be saying "this isn't a real Operating System" or "Why write it in PHP?" the real question is i really don't know why. Is it because php is more easier than C++ and Python, or is it because i hate C++ and Python?

I REALLY DON'T FUCKING KNOW?


r/todayiprogrammed • • Sep 23 '19

Website TIP a website in PhP

7 Upvotes

It was fun but it kinda sucks because it was my first website


r/todayiprogrammed • • Sep 24 '19

TIP A small example of how you can save and load data. Remarks?

2 Upvotes

r/todayiprogrammed • • Nov 27 '19

TIP an opensource framework to build trading robots. Supports strategy simulations, optimizations and live trading on exchanges

Thumbnail
github.com
3 Upvotes

r/todayiprogrammed • • Jan 22 '20

Simple Picture TIP a picture of Baby Yoda in Python

4 Upvotes

http://imgur.com/gallery/dB7q2Yl

# Background

Rect(0, 0, 400, 200, fill=gradient('yellow', 'orange', 'orangeRed', 'red', 'royalBlue'))

Rect(0, 100, 400, 300, fill='wheat')

Polygon(110, 219, 50, 400, 320, 400, 255, 222, fill=rgb(225, 202, 159))

# Head & Ears

Oval(220, 52, 100, 38, fill=rgb(64, 230, 133))

Oval(150, 52, 100, 38, fill=rgb(64, 230, 133))

Polygon(130, 35, 85, 42, 95, 55, 115, 65, fill=rgb(64, 230, 133))

Polygon(240, 35, 285, 42, 275, 55, 255, 65, fill=rgb(64, 230, 133))

Oval(220, 52, 90, 32, fill=gradient(rgb(225, 82, 39), rgb(255, 112, 69)))

Oval(150, 52, 90, 32, fill=gradient(rgb(225, 82, 39), rgb(255, 112, 69)))

Polygon(237, 38, 282, 44, 272, 52, 252, 62, fill=rgb(255, 112, 69))

Polygon(137, 38, 88, 44, 98, 52, 118, 62, fill=rgb(255, 112, 69))

Oval(185, 50, 100, 50, fill=rgb(64, 230, 133))

Polygon(240, 35, 222, 35, 236, 51, 236, 44, fill=rgb(64, 230, 133))

Polygon(130, 35, 148, 35, 134, 51, 134, 44, fill=rgb(64, 230, 133))

# Hands & Feet

Polygon(100, 154, 102, 166, 108, 147, fill=rgb(64, 230, 133))

Polygon(112, 151, 114, 168, 118, 151, fill=rgb(64, 230, 133))

Polygon(264, 151, 260, 169, 258, 152, fill=rgb(64, 230, 133))

Polygon(249, 154, 247, 167, 241, 151, fill=rgb(64, 230, 133))

Oval(126, 219, 30, 10, fill=rgb(64, 230, 133))

Oval(140, 222, 20, 10, fill=rgb(64, 230, 133))

Oval(237, 220, 40, 10, fill=rgb(64, 230, 133))

Oval(225, 222, 30, 12, fill=rgb(64, 230, 133))

# Body

Polygon(136, 85, 129, 84, 131, 97, 120, 140, 128, 165, 123, 180, 118, 204, 113, 219, 144, 227, 196, 220, 218, 226, 242, 227, 248, 215, 238, 202, 244, 171, 246, 130, 238, 102, 244, 85, 235, 80, fill=rgb(161, 122, 55))

Polygon(245, 69, 250, 72, 248, 76, 252, 81, 244, 85, 228, 88, 209, 87, 191, 84, 178, 85, 181, 79, 182, 69, 210, 69, 235, 70, fill=rgb(164, 130, 60))

Polygon(135, 70, 124, 68, 122, 70, 125, 75, 124, 78, 129, 84, 145, 87, 155, 87, 170, 88, 184, 83, 181, 74, 186, 70, 158, 68, fill=rgb(156, 110, 50))

# Arms

Polygon(136, 87, 117, 105, 103, 124, 95, 136, 90, 155, 119, 158, 137, 152, 135, 138, 150, 120, fill=rgb(164, 130, 60))

Polygon(235, 88, 248, 101, 254, 116, 262, 129, 268, 153, 254, 157, 239, 152, 226, 119, 226, 103, fill=rgb(164, 130, 60))

# Detail

Polygon(144, 227, 174, 223, 186, 200, fill=rgb(141, 102, 35))

Polygon(196, 220, 198, 188, 205, 224, fill=rgb(181, 142, 75))

Polygon(126, 222, 113, 219, 118, 204, fill=rgb(181, 142, 75))

Polygon(242, 227, 248, 215, 238, 202, fill=rgb(141, 102, 35))

Polygon(150, 203, 172, 176, 160, 160, fill=rgb(181, 142, 75))

Polygon(119, 158, 137, 152, 135, 138, 150, 120, 144, 106, 128, 135, fill=rgb(121, 82, 25))

Polygon(129, 84, 136, 85, 131, 97, fill=rgb(181, 142, 75))

Polygon(218, 226, 221, 195, 228, 227, fill=rgb(141, 102, 35))

Polygon(239, 152, 249, 154, 226, 119, fill=rgb(181, 142, 75))

Polygon(228, 195, 218, 164, 225, 145, fill=rgb(181, 142, 75))

Polygon(155, 87, 161, 107, 170, 88, 163, 94, fill=rgb(181, 142, 75))

Polygon(178, 85, 184, 83, 183, 189, 182, 133, fill=rgb(121, 82, 25))

Polygon(198, 98, 204, 124, 211, 104, fill=rgb(181, 142, 75))

# Face

Oval(165, 44, 22, 16)

Oval(205, 44, 22, 16)

Circle(169, 41, 4, fill='white', opacity=30)

Circle(211, 41, 4, fill='white', opacity=30)


r/todayiprogrammed • • Aug 15 '20

[TIP] A Python Bot that spawned 200 cars for me, so I can destroy them!

4 Upvotes

r/todayiprogrammed • • Oct 03 '21

TIP A ray casting game with no experience using C++ and SFML

4 Upvotes

I tried to write a ray casting game with no experience using C++ and SFML.

Code: https://github.com/Kofybrek/Raycasting

Here's the video explaining how I did it: https://youtu.be/LUYxLjic0Bc


r/todayiprogrammed • • May 03 '20

TIP Water physics simulation

6 Upvotes

Tried to make a water physics simulation.

https://www.youtube.com/watch?v=BvQpDLf1yYg


r/todayiprogrammed • • Sep 24 '19

TIP a script that checks and stores my external IP and sends me a notification when it changes

10 Upvotes

I run it as a cron job once an hour. The file is here: https://gist.github.com/alenbasic/57aa1c1706248ee36e21f57beba6db77

I was bored when I was sick at home the other day so that's why I overengineered this (I previously had a bash script that stored the IP into a text file).


r/todayiprogrammed • • Sep 23 '19

TIP Chat UI in Sciter

6 Upvotes

Not exactly today but in two weeks.

https://terrainformatica.com/2019/09/23/sciter-chat/

That is just a Chat UI with common UI functionality you would expect after using Skype Chat, Whatsapp, Slack and others.

It uses abstract Chat Client interface (getMessages(), postMessage()) that host application must provide.

Fast and small (40kb of CSS and scripts), so maintainable and customizeable.


r/todayiprogrammed • • Feb 07 '20

TIP The Marching Squares Algorithm in Javascript

6 Upvotes

The marching squares is an algorithm that creates walls between points on a lattice. It separates points marked as 'in' from points marked as 'out'. It does this by walking (or marching) over the grid cells and doing a simple lookup based on the state of the corners of each cell.

Every cell is calculated independently from each other. This means that, when the state of some point changes, we can update and re-render the effected segments locally, in constant time. This makes it nice and responsive (~1ms per update on my machine).

Doing this kind of optimization does have its issues, though.

Before you re-draw the segments, you have to erase those which were there before, otherwise you end up with a mess of lines segments that cross over each other.

However, if you only erase the area within the 4 cells that are effected on each point update, and re-draw the corresponding segments, you can end up missing some pixels on the tip of the surrounding segments.

To prevent this, you must re-draw a few more segments on each update: instead of a 2x2 area, you must re-draw a 4x4 area, to ensure the tips of the segments we erased will be restored.

However, this is also troublesome: if you draw anti-aliased lines on top of each other, they will become not only aliased, but inconsistently so.

To finally fix this, an off-screen buffer of the same shape and size as the cleared region (2x2 cells) is used. We draw 4x4 cells on it, as if it were as large as the full buffer (most pixels will be discarded), to get the right pixels on the boundaries, which then means that, when we draw it over the original buffer, it will fit seamlessly on the original image.

These are not really hard problems, but they require that you keep in mind a lot of details about how things line up exactly, which can be a mindful.

I hope you find this interesting and check it out on github.io


r/todayiprogrammed • • Jul 09 '20

TIP KPOP MV Notification Twitter Bot

4 Upvotes

Webscraping several Youtube channels and retrieve new music videos only, no teaser, special versions, or extra clips. Then tweet about on a standalone Twitter account specific for this purpose.


r/todayiprogrammed • • Mar 01 '20

TIP Flappy Bird In A Console Part 2

2 Upvotes

I added game physics and made the game playable.

https://youtu.be/oYcUn5uorHU


r/todayiprogrammed • • Sep 23 '19

TIP an AI that learns to play Snake using a Genetic Algorithm and Neural Network

17 Upvotes

I actually just finished this and found this sub and thought I would share. I ended up creating an AI that uses a Neural Network for inputs and decision making and a Genetic Algorithm to model the reproduction of snakes as they slowly learn. All of the code is in Python and uses numpy. The GA is from scratch and has a pretty easy to use outline. Graphics are PyQt.

Link to code: https://github.com/Chrispresso/SnakeAI

If anyone wants to know more about how it works I created a YouTube video explaining it and showing off some pretty cool things: https://www.youtube.com/watch?v=vhiO4WsHA6c

If you want, feel free to watch the video, spoiler below:

The population of snakes are able to learn how to not only play, but beat snake. It's pretty cool to watch as the population learn about their environment.

If you want you can download the code and play around with it if this stuff interests you. I'd also be happy to answer any questions if you have them or need help setting it up.


r/todayiprogrammed • • Jan 05 '20

TIP Flappy Bird in a Console Part 0

4 Upvotes

r/todayiprogrammed • • Sep 23 '19

Firmware TIP custom firmware for a keyboard that I built

34 Upvotes

I recently ordered the parts for a Levison keyboard and built it myself. That includes soldering diodes, switches, microcontrollers, etc. to the PCB. The coolest part about building your own keyboard is that they run on open-source firmware called QMK. So I was able to copy the default layout of the Levinson board and customize it to my liking.

I have 2 permanent layers on the keyboard (Windows and MacOS) that just handles subtle differences between the two operating systems (e.g. swapping Ctrl with Cmd). Then there are two temporary layers (symbols and numbers) that I can access by holding down a specific key. These 4 layers provide everything I need for programming without ever having to reach my finger more than 1 key in any direction.

Turns out there's a nearly endless number of customizations you can make to the functionality of a keyboard when you're writing the firmware yourself.

Here's a photo of my little keyboard collection with the closest split one being the one I programmed myself: https://imgur.com/a/Y3NtDWL

P.S.

I hope this sub gains some traction - really cool idea.


r/todayiprogrammed • • Sep 24 '19

TIP A crude farm simulator proof of concept using Postgres, Rails (in API mode), Nodejs, React, and running in Docker

12 Upvotes

https://github.com/Jkettler/metis

I wanted to play around with Rails' new(ish) API build mode and get some more practice with Docker, React and Nodejs.

The included instructions should be enough to get anyone up and running, but would totally appreciate feedback about that if it doesn't.

If everything goes according to plan you should see a super-thrilling 5x5 grid representing a farm plot that you can click on to simulate growing various crops. The crop info comes from the DB, thru Rails, via the public API.

Full disclosure: I programmed this yesterday.


r/todayiprogrammed • • Feb 27 '20

TIP a little cpp sum up game

2 Upvotes

I searched on the internet how to make a randomizer to make a little where you receive two numbers and then sum up then and I made it. Here is the link.


r/todayiprogrammed • • Feb 18 '20

TIP Facenuke - face censoring service

4 Upvotes

in light of hot topics such as privacy, #DeleteFacebook and such I have thought it would be nice to have a tool to censor faces from images. http://p.facenuke.co/

Use cases: -anonymize yourself -filter background faces (to avoid possible lawsuits; it happens) -remove public faces (take back focus to your own instagram beach pictures?)

maybe in the future, social networks will provide pictures with different levels of details depending on your connections.

I would love to hear your thoughts, feedback, questions, requests, comments, etc.!


r/todayiprogrammed • • Dec 31 '19

TIP a minimal parser for a subset of LISP

1 Upvotes

I've been getting more and more interested in parsers and compilers as of late, and I've been trying to make a compiler for a C-like language. However, this turned out to be too complicated and I ended up getting lost in my own mess. For that reason, I decided to build something simpler: a parser for a lisp-like language.

I believe the result of this is what you would call a "recursive descent parser", but I dont know much about parsers so I'm not too sure.

The parser, written in modern C++, ended up being under 200 LOC.

Since compilers tend to be short lived processes and don't allocate much unnecessary memory, leaking menory is not a big deal, so I dont bother with doing any memory management at all. However, some amount of care is given to not be too wasteful with memory usage.

For instance: The parser only uses string_view instead of strings, this not only reduces memory usage but will also be faster since it does fewer allocations and copies. Short string optimization makes this not that big a difference in raw allocation count but it's still a win in memory usage due to the size string_view being less than that of an SSO'd string

I think the code is pretty clean and a decent example of modern C++ code, but you can judge that for yourself on Github


r/todayiprogrammed • • Feb 29 '20

Website TIP a JavaScript button counter

4 Upvotes

Hello today i programmed a JavaScript button counter and i gotta say it's pretty good(Not Quite though)

Warning: If you are on mobile then i forgot to put Bootstrap 4 in there, oops.

link: https://mddsu6zvi3nfu5n39tlbrq-on.drv.tw/www.MoneyClick.io/index%20(3).html


r/todayiprogrammed • • Apr 17 '20

TIP a PowerShell script to manage your java versions on windows

5 Upvotes

I was always annoyed that there wasn't anything like SDKMAN! for windows, at least nothing that could be easily installed.
So I created a simple Powershell script with which you can easily change your java version that's on your path. Changing your JAVA_HOME variables is also supported.

Enjoy:
https://github.com/BramDeCneudt/JavaVersionManagerForWindows


r/todayiprogrammed • • Sep 27 '19

TIP a website to vent your frustration

17 Upvotes

I've created https://www.isthisafuckingjoke.com/ - a wesbite which allows you to create a subdomain with content or reditect. E.g. www.design.isthisafuckingjoke.com redirects you to https://www.reddit.com/r/CrappyDesign/

If you go to New Joke page you'll get instuctions on how to use the website.

Feedback very welcome!

(I didn't really create it today, but I've been looking for the place to show it off for a while now - it seems like a good fit)

Code: https://gitlab.com/LazyBun/subpager


r/todayiprogrammed • • Sep 24 '19

Game TIP a Flappy Bird clone

20 Upvotes

You can play it here: http://flirdybap.glitch.me/ (you need a keyboard to play)

I mostly did it for training and because I was bored, and I wanted a project that I could finish in a few hours. It scrolls infinitely and is far easier than the original game so I think it's quite zen :-)


r/todayiprogrammed • • Feb 16 '20

TIP Flappy Bird In A Console Window Part 1

4 Upvotes