Skip to content

Instantly share code, notes, and snippets.

View TheDcoder's full-sized avatar

TheDcoder TheDcoder

View GitHub Profile
@TheDcoder
TheDcoder / gog-consent.user.js
Last active January 31, 2024 19:03
GOG Don't Giveaway Consent - Revoke consent for sharing data with third-parties when claiming a giveaway
@TheDcoder
TheDcoder / debug.sh
Created August 14, 2023 23:11
Ultimate Debugging for Bash
# Start bash with `-x` option with this env var
export PS4='+(${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }'
@TheDcoder
TheDcoder / symlink-uutils
Created June 6, 2023 07:48
Script to symlink uutils (coreutils made in Rust) into /usr/local/bin so that they are used over GNU coreutils
@TheDcoder
TheDcoder / file-subset-example.sh
Created June 30, 2022 12:18
Check if file A is a subset of file B (file B contains contents of file A)
# Example perl script to check if file A is a subset of file B (i.e. file A has any part of file B)
perl -Mautodie=open -e 'undef $/; open $f1, "<", shift; open $f2, "<", shift; exit !!(-1 == index <$f2>, <$f1>)' -- fileA fileB
# Credit: tirnanog on Libera.Chat
@TheDcoder
TheDcoder / gog-abolish-rep.user.js
Created May 17, 2022 07:27
GOG Abolish Reputation System
// ==UserScript==
// @name GOG Abolish Reputation System
// @author TheDcoder@protonmail.com
// @description Abolish GOG forum's reputation system
// @version 1.0
// @namespace Violentmonkey Scripts
// @match http*://www.gog.com/forum/*/*
// @grant GM_addStyle
// @grant GM_registerMenuCommand
// @grant GM_getValue
@TheDcoder
TheDcoder / lenof.h
Created October 18, 2020 13:26
lenof - C macro function to retrieve lenght (size) an array
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
@TheDcoder
TheDcoder / syncthing_portable.py
Created August 29, 2020 11:29
Portable syncthing helper tool to create portable and isolated instances
#!/usr/bin/env python3
import os
import xml.etree.ElementTree as ET
HOME_DIR_NAME = '.syncport'
CMD_PARAMS = ['-no-restart']
def main():
print("Setting up portable syncthing...")
@TheDcoder
TheDcoder / readfile.c
Last active June 14, 2020 14:56
readfile - Read the contents of a text file into a dynamically allocated buffer efficiently
/*
* MIT License
*
* Copyright (c) 2020 Damon Harris <TheDcoder@protonmail.com>
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@TheDcoder
TheDcoder / pause.c
Created May 24, 2020 21:38
POSIX pause utility
#include <unistd.h>
#include <signal.h>
/* A simply utility to call the POSIX pause function,
* it will keep running and while ignoring SIGINT.
*
* Useful for simulating a hung process
*/
int main() {
@TheDcoder
TheDcoder / gog-image-hunter.user.js
Last active April 13, 2020 05:44
GOG Image Hunter
// ==UserScript==
// @name GOG Image Hunter
// @namespace Violentmonkey Scripts
// @match https://email2.gog.com/view.html
// @noframes
// @grant GM_setClipboard
// @run-at document-start
// @version 1.1
// @author TheDcoder
// @description Started work on 12/4/2020, 8:04:15 PM