Skip to content

Instantly share code, notes, and snippets.

View opentechnologist's full-sized avatar
🏠
Working from home

Mario (BU) Flores Rey II opentechnologist

🏠
Working from home
View GitHub Profile
@opentechnologist
opentechnologist / Elapsed.cs
Created July 23, 2025 00:56
a small c# project with a custom class that keeps track of different elapsed times - useful for determining how long a particular piece of code is running.
using System;
using System.Collections.Generic;
namespace Elapsed
{
public class ElapsedTimeService
{
public class ElapsedTime
{
public DateTime? Last { get; set; }
@opentechnologist
opentechnologist / app.manifest
Created July 8, 2025 00:56
a c# project that uses a manifest file to gain elevated privelege access.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
version="1.0.0.0"
processorArchitecture="X86"
name="main"
type="win32"
/>
<description>Elevated Privelege UAC Demo</description>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
@opentechnologist
opentechnologist / Logger.cs
Created July 6, 2025 07:07
a sample C# project that logs timestamped messages to a text file using a custom text logger class.
using System;
using System.IO;
namespace Logger
{
public class TextLoggerService
{
private readonly string filePath;
public TextLoggerService()
@opentechnologist
opentechnologist / WMI.cs
Created July 6, 2025 06:10
a sample C# project that retrieves workstation information via WMI.
using System;
using System.Collections.Generic;
using System.Management;
/*
https://learn.microsoft.com/windows/win32/wmisdk/wmi-glossary/
https://learn.microsoft.com/windows/win32/wmisdk/wmi-reference/
*/
namespace WMI
{
public class WmiQueryService
@opentechnologist
opentechnologist / CustomTextLogger.cs
Created June 25, 2025 05:22
a custom text logger in C# that will log text to a file created on the user's desktop.
using System;
using System.IO;
public class CustomTextLogger<T>
{
private readonly string filePath;
public CustomTextLogger()
{
string desktopPath = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
@opentechnologist
opentechnologist / app-es5.js
Created June 16, 2025 03:39
a simple example of a web server in express js that supports both http and https. es6 and es5 javascript compatible source codes are provided.
"use strict";
var fs = require('fs');
var http = require('http');
var https = require('https');
var express = require('express');
var app = express();
app.get('/', function (req, res) {
void req;
res.send("Date: ".concat(new Date()));
});
@opentechnologist
opentechnologist / yield_example.go
Created December 10, 2023 23:07
An example of using goroutine channel synchronization and communication to emulate the yield control statement from popular programming languages.
/*
Copyright © 2013 Mario (BU) Flores Rey CC BY-NC-SA 4.0 DEED
License: https://creativecommons.org/licenses/by-nc-sa/4.0/
Tested on GO v1.2.2
*/
package main
import (
"fmt"
@opentechnologist
opentechnologist / brightness.ps1
Created October 28, 2023 23:21
a simple PowerShell script to adjust the screen display's brightness.
<#
.SYNOPSIS
Adjust screen display brightness.
.DESCRIPTION
This script adjusts the screen display's brightness by accepting
a percentage value between 0 and 100 indicating the strength of
the brightness the screen display's backlight should emit.
@opentechnologist
opentechnologist / noemptydir.ps1
Created July 16, 2023 03:27
a simple PowerShell script to remove annoying empty directories.
<#
.SYNOPSIS
Recursively removes all empty directories.
.DESCRIPTION
This script locally traverses all existing directories starting from
the current directory and then employs a depth first removal of empty
directories.