Skip to content

Instantly share code, notes, and snippets.

Avatar
👨‍💻
shipping it :shipit: from home 🏠

C. Augusto Proiete augustoproiete

👨‍💻
shipping it :shipit: from home 🏠
View GitHub Profile
@augustoproiete
augustoproiete / SimpleHttpServer.cs
Created Dec 20, 2015
C# Based HttpListener Static File Web Server
View SimpleHttpServer.cs
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Net;
using System.IO;
using System.Threading;
using System.Windows.Forms;
using Westwind.Utilities;
namespace Westwind.WebConnection
@augustoproiete
augustoproiete / ReadingPortableExecutable_PE_header.cs
Created Dec 6, 2016
Reading the Portable Executable (PE) header in C#
View ReadingPortableExecutable_PE_header.cs
// Credits: John Stewien
// From: http://code.cheesydesign.com/?p=572
/*
Reading the Portable Executable (PE) header in C#
My job consists of writing fully custom applications for groups of people. The time pressure of these projects is quite high, so generally people start using the application while I’m still writing it, which means I write it modularly and add features as I go along. I also fix bugs as they are discovered. My clients are 2 tiered where expert users get a new build first, they test if for a while, and if they think it’s acceptable they then pass it on to others.
This method of distribution is quite ad-hoc so when a client rings me up and asks me to view their screen to look at something, it’s useful to know what build they are running. To facillitate this I print the link date in the main Window Title so I instantly have an idea about how old the version is that I am looking at. This date is calculated at run time. To do this requires reading in the Portable Executable (PE) header from th
@augustoproiete
augustoproiete / detectfx.cpp
Created Nov 29, 2016
Detect .NET Framework installed on the machine (Credits: Aaron Stebner, October 24, 2016)
View detectfx.cpp
#include <stdio.h>
#include <windows.h>
#include <tchar.h>
#include <strsafe.h>
#include <mscoree.h>
// In case the machine this is compiled on does not have the most recent platform SDK
// with these values defined, define them here
#ifndef SM_TABLETPC
#define SM_TABLETPC 86
@augustoproiete
augustoproiete / augustoproiete-cla.md
Created Jun 4, 2021
C. Augusto Proiete Individual Contributor License Agreement
View augustoproiete-cla.md

C. Augusto Proiete Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects ("Projects") made available by C. Augusto Proiete or his affiliates ("C. Augusto Proiete"). This Individual Contributor License Agreement ("Agreement") sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to C. Augusto Proiete in respect of any of the Projects (collectively "Contributions"). If you have any questions respecting this Agreement, please contact hello@augustoproiete.net.

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.

Copyright License. You hereby grant, and agree to

@augustoproiete
augustoproiete / teamcity-metarunner-to-use-special-version-for-nuget.xml
Last active Mar 24, 2021
Example of a TeamCity meta-runner that updates the build.version variable and provides other variants of version variables, such as a special version for NuGet
View teamcity-metarunner-to-use-special-version-for-nuget.xml
<?xml version="1.0" encoding="UTF-8"?>
<meta-runner name="Meta (CaioProiete): Initialize build and set custom parameters">
<description>Initialize the build and set the value of some custom parameters that can be used during the build, such as version, timestamp, and others</description>
<settings>
<parameters>
<param name="mr.initialize_build.releaseBranch" value="%build.releaseBranch%" spec="text label='Release Branch:' description='The name of the branch from where production releases are generated' display='normal' validationMode='not_empty'" />
<param name="mr.initialize_build.verbose" value="SilentlyContinue" spec="checkbox checkedValue='Continue' description='Log verbose messages?' display='normal' label='Verbose:' uncheckedValue='SilentlyContinue'" />
</parameters>
<build-runners>
<runner name="Initialize build and set custom parameters" type="jetbrains_powershell">
@augustoproiete
augustoproiete / GrantAccess-WindowsApps.cmd
Created Oct 12, 2012
Get access to the %ProgramFiles%\WindowsApps folder and view apps source code
View GrantAccess-WindowsApps.cmd
@REM More info:
@REM http://caioproiete.net/en/get-access-to-the-programfileswindowsapps-folder-and-view-apps-source-code/
@echo Backing up current folder permissions to a temporary file
@icacls "%ProgramFiles%\WindowsApps" /save "%TEMP%\WindowsApps.acl" /Q
@if ERRORLEVEL 1 goto rollback
@echo Assigning the ownership of the folder to the current logged user
@takeown /F "%ProgramFiles%\WindowsApps"
@if ERRORLEVEL 1 goto rollback
View keybase.md

Keybase proof

I hereby claim:

  • I am augustoproiete on github.
  • I am augustoproiete (https://keybase.io/augustoproiete) on keybase.
  • I have a public key whose fingerprint is 75C7 661C 8E38 4448 3727 0E05 EDAB B285 2A92 ECE5

To claim this, I am signing this object:

@augustoproiete
augustoproiete / ValidateSelfSignedCertificate.cs
Created Dec 6, 2019
Send e-mail validating self-signed SSL certificate
View ValidateSelfSignedCertificate.cs
// Copyright 2019 Caio Proiete & Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@augustoproiete
augustoproiete / month-name-in-portuguese-using-liquid-jekyll.liquid
Last active Mar 8, 2019
Printing month name in Portuguese using Liquid/Jekyll
View month-name-in-portuguese-using-liquid-jekyll.liquid
{% assign m = page.date | date: "%-m" %}
{% capture month_name_pt %}
{% case m %}
{% when '1' %}Janeiro
{% when '2' %}Fevereiro
{% when '3' %}Março
{% when '4' %}Abril
{% when '5' %}Maio
{% when '6' %}Junho
{% when '7' %}Julho
View PhatomReferenceQueue.cs
public class PhatomReferenceQueue<THandle>
{
private BlockingCollection<THandle> _queue = new BlockingCollection<THandle>();
private ConditionalWeakTable<object, PhatomReference> _refs = new ConditionalWeakTable<object, PhatomReference>();
public void Register(object instance, THandle handle)
{
_refs.Add(instance, new PhatomReference(this, handle));
}