Skip to content

Instantly share code, notes, and snippets.

View sidewinder040's full-sized avatar
๐Ÿ™‚

Mark Crouch sidewinder040

๐Ÿ™‚
  • Bedfordshire, England
View GitHub Profile
@sidewinder040
sidewinder040 / how-to-ssh-agent.md
Created December 28, 2025 19:59 — forked from nepsilon/how-to-ssh-agent.md
Remember passphrases with ssh-agent โ€” First published in fullweb.io issue #31

How to use ssh-agent to cache your SSH credentials?

Contributed by Fabien Loudet, Linux SysAdmin at Rosetta Stone

Tired of always having to enter your SSH key passphrase when logging in to remote machines? Here comes ssh-agent. Enter the passphrase once and it will keep it in memory for you

Using ssh-agent in your shell session:

@sidewinder040
sidewinder040 / get_config_path.cpp
Last active July 5, 2025 08:19
C++17 - Get Current Working Directory Path
#include <cstdlib>
#include <iostream>
#include <string>
std::string getHomeDirectory() {
const char* home = std::getenv("HOME");
if (home == nullptr) {
throw std::runtime_error("HOME environment variable not set");
}
return std::string(home);
@sidewinder040
sidewinder040 / rss-reader-opts.cpp
Created June 7, 2025 16:36
Boost Program_options Demo (for a RSS Reader
// rss-reader-opts.cpp
// This program demonstrates the use of Boost.ProgramOptions to handle command line arguments
// for a simple RSS reader application. It allows users to list, read, add, and delete feeds.
// To Build: clang++ -O3 -std=c++11 -lboost_program_options rss-reader-opts.cpp -o rss-read
#include <string>
#include <vector>
#include <boost/program_options.hpp>
namespace po = boost::program_options;
#include <iostream>
@sidewinder040
sidewinder040 / realtek-alc898-surround-setup-5.1-analog-3.5mmjacks.md
Created March 21, 2024 20:13 — forked from Brainiarc7/realtek-alc898-surround-setup-5.1-analog-3.5mmjacks.md
Analog surround sound setup on Linux with a Realtek ALC898 sound card on the Clevo P751DM2-G

Setting up analog surround sound on Ubuntu Linux with a 3 3.5mm capable sound card:

A while back, I received the Logitech Z506 Speaker system, and with Windows, setting it up was a pretty plug and play experience. On Linux, however, its' a wholly different ballgame. For one, there's no Realtek HD Audio control panel here, so what gives? How do you around this problem?

Introducing the tools of the trade:

You'll want to use a tool such as hdajackretask , pavucontrol and pavumeter for the pin re-assignments and audio output monitoring afterwards respectively. The tools are installed by running:

sudo apt-get install alsa-tools-gui pavumeter pavucontrol
@sidewinder040
sidewinder040 / Makefile
Last active July 6, 2024 19:08
A More Elegant Makefile Example
# Compiler
CC = gcc
# Compiler flags
CFLAGS = -Wall -Wextra -pedantic
# Source files
SRCS = datecode.c date_validator_helper.c main.c
# Object files
@sidewinder040
sidewinder040 / CMakeLists.txt
Created January 14, 2023 15:50
An Example of Using VCPKG with CMake
cmake_minimum_required(VERSION 3.20.0)
# change this to your path
set(CMAKE_TOOLCHAIN_FILE "E:/src/vcpkg/scripts/buildsystems/vcpkg.cmake")
project(demo)
add_executable(${PROJECT_NAME} main.cpp)
# use your prefix paht if the toolchain doesn't work
@sidewinder040
sidewinder040 / refector.sh
Created September 22, 2022 18:26
Archlinux Reflector - Update Mirrorlist to fastest list
sudo reflector --country "GB" --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
@sidewinder040
sidewinder040 / Makefile
Created June 24, 2022 19:40
Makefile - Simple Example
CC = g++
CFLAGS = -g -Wall -Werror
test: test.o
test.o: test.cpp
clean:
rm test *.o
# Installation on Dell XPS 9570
# Connect to Internet
wifi-menu
# Sync clock
timedatectl set-ntp true
# Create three partitions:
@sidewinder040
sidewinder040 / enums3.rs
Created April 22, 2021 22:10
Rustlings enums3.rs - Solved
// enums3.rs
// Address all the TODOs to make the tests pass!
// Solved by refering to other peoples attempts, then by trial & error
// Passes all the tests.
enum Message {
// TODO: implement the message variant types based on their usage below
ChangeColor((u8, u8, u8)),
Echo(String),