Post your coding projects

Everytime :eyes: :footprints:

1 Like

GUI updates! :smiley:

1 Like

You should really learn to make smaller commits. (IMO)

I find it’s easier to track things when I make 10 small commits rather than 1 large commit. It also makes merging and rebasing easier. Takes a bit more time, but it’s easier in the long run because when commits conflict, you have fewer changes to work through.

1 Like

I do that at work because our SSL wrapper blocks ssh and https pushing with git. So when I do commits I have to do it from my hotspot, so I just commit everything that I was working on when I leave work.

Also, once I feel like I reach a version that is 1.0 worthy, then the flurry of updates will cease and they will be smaller like you mentioned.

Ah, you do know you can make multiple commits, not push and then push 5 or 10 commits in one go, right?

I totally understand that though. One of my programming locations blocks SSH pushing and HTTPS is hit or miss, depending on the day. Haven’t quite figured that one out though…

I’m working on a lightweight blockchain written in C and using libsodium for cryptography. It’s still super in development because of life and whatnot. It’s for learning, but I eventually want to add modules so people can build up blockchain networks really quickly.

So… like this?

1 Like

I you are feeling a little masochistic and bored, I recently uploaded to GitHub some Win32/COM/Office Automation projects that I started around 2008. https://github.com/cburn11/Office

I spend a lot of time in Office/Word, often doing repetitive tasks. I wrote a few programs to streamline some tasks. The most interesting program is called ClipboardToWord. It monitors the clipboard, if it sees a new bitmap has been placed on the clipboard, it copies the bitmap into word. Combined with the snippings tool, this made my life a little easier.

The original program was written in C because that’s what I knew from undergrad, (I am a lawyer) and so I went with what I already knew. Later I bolted on top of the original C program IDispatch interfaces so I could use ClipboardToWord from vb scripts. On top of that, I then added an event source (through IConnectionPointContainer/IConnectionPoint) and the ability to load plugins. At this point, I think I had gotten tired of the detail required to work with COM from C, so I started using C++.

The most useful plugin that I made to extend ClipboardToWord, takes the bitmap, converts it to a TIFF file (using the WIC APIs), and then performs OCR on the TIFF through Office’s old MODI component. When combined with the snippings tool, it looks like this https://i.imgur.com/1ePrRQd.png. You can snip a portion of the screen, then a message box pops up with recognized text that you can then copy and paste. I must have tired of trying to write COM components with plain C++, because the last versions of my plugins are ATL for the COM stuff.

I had mostly forgotten about these things, but they came back to my attention when someone at a former office ran into trouble. I was shocked anyone actually used these buggy, trerrible UI things. It took me a while to recall how everything worked. To save myself some trouble in the future, I uploaded the bulk of the projects to github with my notes.

But if you want to see a win32 C program with COM Automation, written in C, bolted on top, with COM connection points, written in C++, bolted on top of that, with ATL plugins to extend functionality, accessible by anything that can drive/consume COM automation (think VBA/VB script) all written by a non-programmer (meaning this is really bad stuff), then enjoy.

1 Like

I recently got my hands on an ArduCopter drone (3DR Solo) so I’ve been tinkering with that. I wanted an easy way to do a dual-operator mode for controlling the gimbal, and I also wanted a sort of “trainer” mode since I am accustomed to having that when I let newbies fly other RC aircraft.

So I created a WebSockets API for the drone. 3DR already did the dirty work when they built DroneKit.io so all I had to do was make a WebSockets server that wraps around that Python lib. I can manipulate flight modes, set home location, control the gimbal, etc from a webpage, and I get all the attributes from the drone in real time. It’s not 100% complete yet, but it’s reasonably stable and pretty cool to play with.

If you’re feeling adventurous: https://github.com/k4kfh/DroneKitHTTP/

Obviously this represents a potential for seriously stupid security decisions, but I’m being careful about network topology and such in situations where this is used, and I’ve built some pretty good security into the API itself.

This is the win32/c++ password manager (github) that I use to help me conveniently use long random passwords for each site I have a login.

The manager loads xml files, or decrypts and loads xml files) that contain account credentials. For a selected credential, the manager can then launch the appropriate URL and uses the clipboard to copy and paste the username and password. The encrpytion used is AES256 from the windows bcrypt library. Changes to the file can be saved either as plain xml or encrypted.

The saved encrypted files are as secure as the key used to encrypt them, which is convenient for saving the file a cloud/network storage. But the application itself does not make any attempt to secure it’s memory while running. But I use this on my local machines as a convenience only.

The password generator is a simple win32/c program that uses the bcrypt randum number generator to create a customized password string containers letters, digits, spaces and symbols.

not done anything for processing the media/renaming yet

but did have significant improvement in the distribution just trying to figure out the easiest way to display the results.

before was like 10-15%spread(spread being when the first series ended before the end of the list, down to about 5%, atleast in the tested list)

distribution stuff

the improvement was in changing the ‘boot strapping’ to have a variable threshold, and also do it as few times as possible but reup something if needed, eventually opening up the threshold to include more things,

starting out like… 1/2 the length of the longest sublist or longer, put one segment, then try the normal math, if it fails do it again, if it fails twice in a row(as in no more present segments over 1/2 the length of the longest sublist do 1/3, 1/4, 1/5, 1/10th, then any list

which was the new one ended up right near the end it had to boot strap the shorter ones last segments, but ended up working out really good in that, in only does a single segment from a single list, but it goes in order still, so will boot strap first series it finds long enough, then if needs another one, will do second found, third and so on

so it does a cycle of the longest sublists until it kicks in the normal math starts passing, and the thing at the end where it would be the one longest list playing a bunch in a row was cut way down to just a couple segments in a row(in this case atleast) compared to being like 25-30 of the segments of the last ~40 being the same sublist

did bit of formatting on the table to compact it a bit and added a extra line break every 10 sublists to help scroll/count fast(for long lists)

added a command to print the table to a file, added to the help text and stuff

@anon36666293 is an example of the entire table

already had mklowcase

but made
instr (directory) (string to be inserted) (character that string starts on)
and also
rmbp (directory)
this one removes brackets and periods(probably make it do ‘-’ and ‘_’ aswell), but for brackets if it sees the opening ‘(’ or ‘[’ will remove everything until it sees ‘)’ or ‘]’ (other than it always passes through the last 4 characters of the file name, which is usually most extensions for video files, ‘.mp4’ ‘.m4v’ ‘.mkv’ etc)

possibly make one to delete a given number of characters starting at a given point.

then whenever am happy with these, might repack them into a single thing, or into mkli, or mkli and all of them into mcli, not really sure yet

edit:
made a
rmcs (directory) (number of characters to omit) (number to start omitting on)

this one has bit danger though, have to be careful with the numbers(if you remove them could result in many files being renamed the same name, over writing all of the previous ones)

x-post

Most of these are just tools I needed to make my life easier, with the exception of my twitch chat bot:

Warframe launcher for linux (complete replacement)

Script for creating a flatpak of league of legends

vulkan easy-install script for vulkan and dxvk wine prefixes:

QuorraBot - Java based twitch.tv chat bot.:
https://github.com/GloriousEggroll/quorrabot

ffmpeg-vaapi - vaapi plugin for obs to utilize vaapi ffmpeg stream/video encoding on mesa for linux:

3 Likes

made a thing to help not mess stuff up(displays the number of characters, probably gonna add an option to print all the files in the directory the same way, instead of just the first one)

makes easier for counting but also helps detect if double/multiple spaces, or space is first character etc. although i did add to prevent that stuff into the rmbp thing(strings of spaces will only result in a single space, wont write a space as first character, etc)

mediamanutils

I’m < 1yr in python and barely a week in C++ so one of my small goals was to rewrite this in C++ (i wrote it in python last year). Needs (at least) a little cleaning up, but works.

unabridged explanation…
I use multiple instances of hyperion + raspi to control lighting in my home (4 rooms), and wanted to use the same app to control some incandescents, so I sloppily put together a box with a receptacle, relay, and a pi3. At first I used a physical jumper to loopback the serial gpio pins to read hyperion data, but have since realized that the command line utility reports color information I can parse with subprocess calls.

tl; dr is any nonzero color data activates the relay

1 Like

I’m gonna send you a PR

1 Like

PR has been sent.

1 Like

made a ‘rmhb’ that does the same thing as rmbp but also has detection for the handbrake auto-naming thing where it appends the title number as ‘-###.extension’ to remove the ‘-’ and the digits

might update it to not do the other rmhb stuff though

More HW shizz
me a big boi now can use maps
Enjoy making fun of it :smiley:

Yung boi bad code
// Rodrigo Santillan

#include <iostream>
#include <string>
#include <time.h>
#include <map>

using namespace std;

//Thanks Professor Redden
void listUsers(map<string, string>* arg) {
	if (arg->empty()) {
		cout << "No users in the list" << endl;
	}
	else {
		cout << "********************" << endl;
		map<string, string>::iterator it;
		for (it = arg->begin(); it != arg->end(); it++) {
			cout << it->first << endl;
		}
		cout << "********************" << endl;
	}
}

void userRegister(map<string, string> &mapArg) {
	string temp1, temp2;
	int found;

	cout << "Enter a username: ";
	getline(cin, temp1);
	found = mapArg.count(temp1);
	if (found >= 1) {
		cout << "User with that name already exist" << endl;
		}
	else {
		cout << "Enter a password: ";
		getline(cin, temp2);

		mapArg[temp1] = temp2;
		temp1.clear();
		temp2.clear();
	}
}

bool userLogin(map<string, string> &mapArg) {
	string temp1, temp2;
	int found, count = 0;

	cout << "Enter user name: ";
	getline(cin, temp1);
	found = mapArg.count(temp1);
	if (found == 1) {
		do {
			cout << "Enter password: ";
			getline(cin, temp2);
			if (mapArg[temp1] == temp2 && count < 3) {
				cout << "\nWelcom Back " << temp1 << endl;
				return true;
				break;
			}
			else {
				cout << "Incorrect password!" << endl;
				count++;
				cout << "You have " << 3 - count << " attempts remaining" << endl;
				}
			} while (count <3);
		}
	else {
		cout << "No user with name " << temp1 << " exists" << endl;
		return false;
	}
	temp1.clear();
	temp2.clear();
		
}

bool userWelcomeMenu(map<string, string> &arg) {
	string temp1, temp2, temp3;
	int found;
	char wm;
	cout << "\n\nWhat would you like to do?\nTo log out enter 'l'\nTo change password enter 'c'\nTo list users enter 'u'\nTo delete user enter 'd'" << endl;
	cin >> wm;
	cout << endl;
	cin.ignore();
	switch (wm) {
	case 'l':
		cout << "Logging out . . ." << endl;
		return false;
		break;
	case 'c':
		cout << "Enter username: ";
		getline(cin, temp1);
		found = arg.count(temp1);
		if (found == 1) {
			cout << "Enter password: ";
			getline(cin, temp2);
			if (arg[temp1] == temp2) {
				cout << "Validation successful!\nEnter new password: ";
				getline(cin, temp3);
				arg[temp1] = temp3;
				cout << "Password changed!" << endl << endl;
					return false;
			}
			else
			{
				cout << "Validation failed" << endl;
			}
		}
		else
		{
			cout << "No user with the name " << temp1 << " exists" << endl;
		}
		return true;
		break;
	case 'u':
		listUsers(&arg);
		return true;
		break;
	case 'd':
		cout << "Enter username: ";
		getline(cin, temp1);
		found = arg.count(temp1);
		if (found == 1) {
			cout << "Enter password: ";
			getline(cin, temp2);
			if (arg[temp1] == temp2) {
				cout << "Validation successful!" << endl;
				arg.erase(temp1);
				cout << "User deleted" << endl;
				return false;
			}
			else
			{
				cout << "Validation failed" << endl;
			}
		}
		else
		{
			cout << "No user with the name " << temp1 << " exists" << endl;
		}
		return true;
		break;
	default:
		return true;
		break;
	}
	temp1.clear();
	temp2.clear();
}

int getRand(int M, int N) {
	return (M + (rand() / (RAND_MAX / (N - M))));
}

int main()
{
	srand(unsigned(time(NULL)));
	map <string, string> Database;
	char lr;
	char re;
	
	Database["RJ1994"] = "012345";
	Database["J990"] = "secretpassword";
	Database["Jim876"] = "696969";
	Database["Sam123"] = "password123";


	do {
		cout << "To login enter 'l'\nTo register enter 'r'\nTo exit enter 'e'" << endl;
		cin >> lr;
		cin.ignore();
		switch (lr) {
		case 'l':
			if (userLogin(Database) == true) {
				cout << "It has been " << getRand(1, 999) << " days since you last logged in.\n"
					<< "You have " << getRand(1, 9999) << " unread messages" << endl;
				do {
					
				} while (userWelcomeMenu(Database) != false);
			}
			break;
		case 'r':
			userRegister(Database);
			break;
		case 'e':
			cout << "Goodbye" << endl;
			return 0;
			break;
		default:
			cout << "Invalid Input" << endl;
			break;
		}
		cout << "Perform another action? (y/n)" << endl;
		cin >> re;
		cout << endl;
	} while (re == 'y' || re == 'Y');
	return 0;
}


/*
Write a program with two options: "register new user" and "log-in".

Register user should allow a new user to create a user name and password.  User names are unique and not allowed to be repeated in the system.

Log-in should allow a user to log in and access a second area with options for "change password", "list users", "delete user" and "log out".

Design an ADT and choose appropriate containers in the STL (use a Map) and populate the system with test data before turning this in.*/