Post your coding projects

Small, niche contribution here:

I recently found myself in the strange situation of needing to backup a FreeNAS box to a Thunderbolt RAID attached to a Mac Mini.

Needless to say, macOS did not play nice with the built-in FreeNAS rsync scheduler.

Here’s the gist of my script that rsyncs the most recent FreeNAS snapshot to the macOS backup target:

1 Like

Spending tonight learning about GraphQL integration with MongoDB.

Tomorrow’s going to be all about CASL.

Working on building a custom collaboration portal for one of the organizations I volunteer with. Planning on releasing it under LGPL when it becomes something I’m not ashamed of.

EDIT: It looks like GraphQL doesn’t support the authentication I need. I’m going to have to hold off on it until it’s fully-featured. Moving on to CASL tonight, once I get REST re-integrated.

I’m working on a budgeting application that my wife and I can use.
The backend is a web api using .net core with entity framwork core. The frontend is going to be html, css, and react.

So far, I have most of the backend done, but I’m learning how react works.

1 Like

Does creating Fedora packaging scripts count as coding? if so: https://copr.fedorainfracloud.org/coprs/stenstorp/Elementary/
Just trying to get some ElementaryOS programs packaged for Fedora and CentOS.

Made this thing for a friend as a practice project of sorts: https://imgur.com/a/ztJQ8

It´s a management software of sorts mostly tailored towards animes and mangas specifically (because that one friend had a million chrome bookmarks with mangas and lost track what he read and what he didn´t and what episode of Naruto or whatever he was at).

It can also import some amount of information from a rest-API from myanimelist.net, but you need an account there and set it in my super crappy settings UI (btw it won´t check the account settings even though that would be totally possible to do… it will just not find anything if your account data is wrong rather than complain about it, have to change that sometime, but it´s ok´ish if you know it´s not there cause you didn´t make that and you only have one person to explain it to). The search is also “meh”, since the myanimelist.net API will return results for say “Death Parade”, but won´t return anything for "Death Parade " (with a space at the end). Don´t really know how to deal with that tbh… Not because of that specific example, ofc i can remove the space. But in general I don´t know what the API finds and what not, cause it´s just a Black Box to me I feed stuff into and hopefully get something back and i don´t know when it´s gonna give me things back. Kinda annoying their online search works perfectly, but their API search sometimes behaves super awkward.

CSV as a save file is kinda not the best i´d say, but it was simple and I did that because I didn´t know if i was gonna make it usable and wanted the file to be useful in excel, should I abandon it. UI is far from perfect, but I don´t entirely hate it at this point. However, it might not actually be legal, cause I have not checked if I’m allowed to use the icons I did (at least not all of them) and I didn´t bother making a proper credits view either, so no way to even credit the once that would be legal provided I do that. Not much of a graphic designer really. But I did manage to edit that no-image-image, with a probably copyrighted image as a base… xD

Basically, it´s not really done and might never be, you can have the source if you want it, but it´s not uploaded anywhere yet. Some of it is messy cause it´s my first attempt to do a JavaFX program of “that scale”. Really only did small baby programs for school before. This is huge in comparison to that already.

1 Like

For BS thesis project decided to make a 2D game engine from scratch in pure C. Procrastinated on it forever and now need to actually start coding it. Here’s some progress:

(Click the arrow in top right corner)


I am using SDL2 for the plat stuff, even though before that I was simply using Xlib. But since I want to port it to windows and android in the future, I decided not to rewrite the boring parts and use a proper lib.

In plans is to have swappable renderers as so/dll, GL3.3+, GLES2+ support. Also the game should be an so/dll for the engine too I think.


Much later in the future (probably after the thesis) I’d also like to get Vulkan supported as well as add network capabilities. Depending on time I’ll have I’ll see what I can do with threading it as much as possible. The current idea for that is job/task system. Where you can spawn jobs/tasks to do something in parallel. For example, you can update multiple quadtree areas in parallel since they shouldn’t interact anyways (I think lol).


“More edits?” Sighs

I used to have very simple naive 3D OpenGL renderer written in C++11, but I dislike C++ so I am rewriting it from scratch in C11. Might as well show here what I had:


Added some much needed vector and matrix math:

Also code quality got up a bit IMO:

Still needs tons of refactoring. And pretty much disregard anything in main.c it’s just for testing. Encapsulation FTW yeee! :sunglasses:


Little update:

5 Likes

On my windows 10 install, the built in photo has a bug that causes it to not display correctly when resized with the mouse:

So I threw together a Win32 Direct2D/Direct Composition substitute: Github: ImageViewer.

3 Likes

Got back to working on rendering a bit, finally changed the whole “object renders itself” part to “objects issue themselves to renderer”.

Here are some notes:

                         RENGINE-C BATCH RENDERER BENCH
       ( using render keys for sorting of render states for draw calls)

NOTES:

* 2 shader ids (same shaders tho);
* 6 different textures;
* 2 different meshes;
    (quad and cube (so "Sprites" actually just means entities));
* "Sprites" (entities) are generated with random ids.

IMPLEMENTATION DETAILS:

* World stores each render object in an array that ids reference;
* render_key is just a 64bit int (bit field):

63                           31         0
[SHADER_ID, TEX_ID, MESH_ID, INSTANCE_ID]

* When entities update they push render_key into a buffer (not even a queue);
* After the world is done updating entities, renderer sorts (with `qsort()`)
    render_keys and issues draw calls;
* The whole point is to minimize state change.

=============================================================================
0. NOSORT +  REBIND EACH TIME | Sprites: 25000      | FPS: 18.98 | ms: 52.00
1. SORT   +  REBIND EACH TIME | Sprites: 25000      | FPS: 25.12 | ms: 40.00
2. SORT   +  REBIND IF DIFF   | Sprites: 25000      | FPS: 33.00 | ms: 31.00
3. NOSORT +  REBIND IF DIFF   | Sprites: 25000      | FPS: 20.50 | ms: 49.00
=============================================================================

0. - no key sorting and rebinding (shader, tex, mesh(vao)) for each draw call;
1. - is driver smart enough to not rebind when GL objects are the same;
2. - key sorting + rebinds only if different ids, 24% better than 1.;
3. - MUH BRANCH PREDICTOR.

------------------------------------------------------------------------------

TODO:

* Instanced renderer?

Anyways, I was supposed to be sleeping instead of coding this “highly scientific” bench.

added a -coption for comparing 2 snapshots for the backup data verification thing, and a help test -h

but forgot to take screenshot(s)

so will probably do that after i figure out what am gonna do for the copy on write update for the media server stuff

Wrote a quick ‘n’ dirty script to prep video files I shot on various cameras for use with DaVinci Resolve.

Super simple, takes the file, cuts off the extension, rips the audio out into FLAC (incoming audio is from multiple sources, FLAC means no lossy -> lossy) then rips the video to prores. Prores is not an efficient format, but it’s good quality and works well with Resolve, even on my 1700, 80GB of 4k60 content got converted in a bit under 2 hours.

prores is also fucking huge. 500MB of mp4 turns into 4GB of mov.

#!/bin/bash
  
if [ $# -eq 0 ]
  then
          echo "Destination argument required."
          exit 1
fi

destination=$1

for vid in $(ls *.MP4 *.mp4 *.mov *.wmv); do
        # process file name.
        filename=$(basename "$vid")
        filename="${filename%.*}"
        # Create a flac of the audio stream
        ffmpeg -i $vid -vn -c:a flac $destination/$filename.flac
        # Convert video stream to ProRes
        ffmpeg -i $vid -an -c:v prores -qscale 2 $destination/$filename.mov
        # rename file to *.converted, so we don't waste CPU time on it again
        mv $vid $vid.converted
done

1 Like



md5rcmp3

remembered to get pictures lol,

still need to figure out what am gonna do for the output exactly since isnt super clean currently, and probably dont need anything if it passes(if we give the snippets when it fails/what failed)

think the help text is good enough for now though


also

updated mserv3 and mcli5 to use sort of a copy on write thing, where it copys the pos file when it opens it to scan for play, so that later when it updates the pos file, it has a copy in place of the exact previous value, and moved all the pos, and opos(the copy), to mserv/pos, instead of mserv/db where the actual list files are, just to clean up a bit since will now be 2 files per list(assuming it has more than one segment, and has been played before) just for tracking position

otherwise still need to work on updating/new documentation still

and found some other stuff when was working on the copy on write thing, where i can put in some more checks to try and prevent errors for if, a file becomes corrupted or a crash happens during the write or something and get garbage data, (or if someone manually edited it wrong), for the control file, already beefed it up for the pos file stuff, and already had it verifying file existence and stuff for the list files, at creation and before it tries to open media player,

for the control file already added to verify that theres only digits where should be numbers(as well as checking that atoi, atoll etc, returned value correctly) just need to add in a couple extra override points, for if it fails catastrophically(like if the string supposed to be the list name contained a backslash or non filename allowable characters etc) to just input sane values to return to low power mode

although have already done testing/prevents that stuff on my end, if using mcli5 to issue the commands

So, currently at work attempting to build powershell scripts that

  • audit and report on configured FSRM file screens and file screen groups for an arbitrary number of remote servers
  • reconfigure said servers with new file screen groups and file screens as per configuration stored in XML or CSV files in order to enforce policy

Been working on it for a couple of hours.

Looks like Windows 2012 R2 is the minimum supported baseline OS as 2008 R2 does not have either WMI objects or powershell cmdlets for managing FSRM.

so about half of my servers wont’ work with it :neutral_face:

sigh

Small update:


More small updates:

1 Like

The Animelist thing got a little better too and I also made a git-repo just now.

And compiled version

But I delete that a lot, not really keeping anything in my public dropbox ever for a long time.

So anyways. Now it uses sqllite for saving. I would have used h2, but sqllite seemed a little faster and A LOT smaller. OS restriction is also not there, since the library is compiled for Windows, Linux, Unix and FreeBSD. If I need anything SQLite cannot do, the change to h2 is pretty easy anyways. I used JDBC for that, looking back JOOQ would have been cool to use as a query builder, but I did not want to use JPA for a project of that size for a local DB.

It can now also save links (again). It could that already at one point. But only one link at a time. Now it can do basically unlimited and it has GlobalLinks that you can specify to be valid for content-types (so Anime, Movie, Series, etc) and you can use the fields in the Anime class (actually all of them but bearly any even makes sence… just did that with reflection) and add them to the urls. Like say netflix.com/s=%name% %name% would then be replaced by the name of the Anime (or whatever) you open the link from. I initially also wanted to make it able to add HTTP-Header, but I didn´t find a clean way to tell the browser what to do. I´d say if I want to do that, the best way is to find out how to program for chrome or/and firefox specifically, because otherwise I´d have to like make the request with Java save the response html page and then open that from the disk with a browser and hope for the best, because relative link ain´t work like that.

The CSV thing now is also completely generic, but not used anymore as a Database, but rather for an export / import function that acts kinda like a backup function where you can look at the files easiely.

There are also a lot of other smaller things that have changed. But I´m not doing THAT much anymore on this project right now.

  • Thought I´d have enough idea´s like make the myanimelist.net api thing more pretty (because it looks like trash) and make it be more like a plugin, so I can add multiple Services like that with (after the initial work) only little work, that all do the same thing, just for different content types, or are alternatives to each other.
  • Make it possible to add new entries directly from those rest-services instead of manually typing in the name and then adding the rest as an alternative.
  • Make it work with mysql or/and postgresql so you can use one DB on all your machines and distros easiely and then make it possible to sync to a local sqlite db for taking your notebook outside the door, when you do not have or want a server that is accessable to the world.
  • Making fields like rewatch-value or rewatch-marker or watchlist-priority. Right now there is only seen and not seen and the watchlist is what you have… well not seen.
  • Oh, yeah and JOOQ´ifying the SQL code. But I mean probably not… It´s then the same thing just prettier. Maybe for the mysql or postgresql part.
  • MP3 support in the about window because why not (now it only plays FLACs)

Honestly, I think that´s already enough stuff to do. If I get around I´ll maybe do something of that. Or start another project I suppose.

If you find any major bugs or unexpected behaviours though. You can tell me about those.

I have been on a self hosting kick; and have, among other things, moved my household chat to a mattermost instance behind my firewall. The mobile app was a pain in the ass to build from source since I have never tried to compile an android application, much less integrate one with GCM. But to experiment with the app server’s extensibility framework I threw together a custom slash command and incoming webhook that delivers a weather report. https://github.com/cburn11/weatherbot

From the mobile app:

It’s a c++ cgi/daemon pair that uses google’s geocoding webservice to turn a location string into lat/lng coordinates and then the national weather service’s webservice to grab a weather forecast for lat/lng. Google’s geocode service is impressive. It will spit out a best guess coordinate pair for a just about any string you throw at it.

I got a kick out using Microsoft’s c++ rest sdk (casablanca) for the web queries and json processing. But to give them credit, their library worked without complaint using emacs, clang and cmake to build for a linux target.

Interestingly, the incoming webhook, which just pulls a forecast for a static location and then forwards that to the app server, is just 2 bash scripts that come in under 40 lines total including the 2 lines in the crontab. While the slash command, which doesn’t do a whole lot more, took over 600 lines of c++ spread over 3 executables. To be fair, the bash scripts leans entirely on curl, awk, sed and jq to all its work. But the executables do have a lot of their common code aggregated in libraries.

1 Like

It’s been awhile! I made a very computer science-y tool to track the number and kinds of operations used in C++ sorting algorithms which implement a stdlib like sorting interface. This code can be extended to track the actual operation cost of many stdlib functions at a depth not possible otherwise. However, it does require modifying libc and I have a request into glibc for that and will likely put forth one for the C++ standard later. It isn’t perfect, but it is about as good as you can get.

@oldgek Dude! That’s so awesome. What IDE/Editor/Colorscheme(if Vim???) is that?

I recently learned about including the git branch in the directory path, which is an amazing tool.

Thanks! It’s vim with a few plugins, main ones being: vim-airline, nerdtree and vim-surround. The colorscheme for the shell and vim is nord. It’s available for lots of stuff:

I also use tmux since atm I am using KDE, but I prefer i3wm. And in any case tmux rules :slight_smile:

1 Like

Beautiful! Thank you. That color scheme is what I’ve been looking for. Currently I use Cthulhian. Also have Nerdtree lol. Vundle and YouCompleteMe with others.

Also, x2 on i3 or KDE + tmux master race :wink:

1 Like

I am working on a program that will randomly pick out clothes for you. It’s called Closet Plus Plus. Currently, I am working on an ncurses frontend and a SQL backend. This was mainly just to force me to relearn C++ and learn new stuff.