Skip to content

Instantly share code, notes, and snippets.

View su8's full-sized avatar

su8

  • defunct
View GitHub Profile
@su8
su8 / safeInt.cpp
Created October 14, 2026 11:02
safeInt.cpp
// Utility: safe integer input
int safeInputInt() {
int val;
while (true) {
std::cin >> val;
if (!std::cin.fail()) return val;
std::cin.clear();
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
std::cout << "Invalid input. Enter a number: ";
}
@su8
su8 / mp3metadata2.cpp
Created October 13, 2026 12:29
mp3metadata2.cpp
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <stdexcept>
// Struct to hold metadata
struct MP3Metadata {
std::string title;
std::string artist;
@su8
su8 / favs.diff
Last active July 31, 2026 13:19
favs.diff
96a97,99
> // Load,Save,Remove favourite song(s)
> std::vector<std::string> loadFav(void);
> void addFav(int toRemove);
100a104,106
> int highlight = 0;
> int showFavourites = 0;
> std::vector<Track> playlist;
101a108
> std::vector<Track> playlist3;
#!/bin/bash
# Usage: cmus-rate [1-5]
#
# Rate tracks playing in cmus and add them to corresponding playlists.
#
# The track currently playing in cmus is added to an M3U playlist corresponding
# to the given rating ("[1-5].m3u") and removed from any other rating playlist.
# If no argument is given, the track is removed from all rating playlists.
#
# The playlists are kept sorted.
@su8
su8 / vlc3.cpp
Last active December 13, 2025 02:45
vlc3.cpp
#include <iostream>
#include <string>
#include <thread>
#include <atomic>
#include <chrono>
#include <csignal>
#include <vlc/vlc.h> // Requires libVLC development headers
std::atomic<bool> running(true);
@su8
su8 / json.hpp
Created December 9, 2025 22:44
json.hpp
This file has been truncated, but you can view the full file.
// __ _____ _____ _____
// __| | __| | | | JSON for Modern C++
// | | |__ | | | | | | version 3.12.0
// |_____|_____|_____|_|___| https://github.com/nlohmann/json
//
// SPDX-FileCopyrightText: 2013-2025 Niels Lohmann <https://nlohmann.me>
// SPDX-License-Identifier: MIT
/****************************************************************************\
* Note on documentation: The source files contain links to the online *
@su8
su8 / hex.cpp
Last active December 9, 2025 16:04
hex.cpp
/*
* Copyright 12/05/2025 https://github.com/su8/0verhex
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@su8
su8 / yt-dl.cpp
Last active December 7, 2025 02:23
yt-dl.cpp
//g++ youtube_downloader.cpp -o youtube_downloader -lcurl
#include <iostream>
#include <string>
#include <cstdio>
#include <cstdlib>
#include <array>
#include <memory>
#include <stdexcept>
#include <sys/stat.h>
@su8
su8 / main36.cpp
Last active December 5, 2025 06:56
main36.cpp
/*
* Copyright 12/03/2025 https://github.com/su8/0vershell
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@su8
su8 / main35.cpp
Created December 4, 2025 03:33
main35.cpp
/*
* Copyright 12/03/2025 https://github.com/su8/0vershell
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the