Skip to content

Instantly share code, notes, and snippets.

View xue2sheng's full-sized avatar

Andres Sevillano xue2sheng

View GitHub Profile
#include <windows.ui.composition.interop.h>
#include <ShellScalingAPI.h>
#include <DispatcherQueue.h>
#include <winrt/Windows.System.h>
#include <winrt/Windows.UI.Composition.Desktop.h>
extern "C" IMAGE_DOS_HEADER __ImageBase;
using namespace winrt;
using namespace Windows::UI;
#pragma comment(lib, "onecore")
#pragma comment(lib, "propsys")
#include <shlobj.h>
#include <propvarutil.h>
#include <propkey.h>
#include <notificationactivationcallback.h>
#include <winrt/Windows.UI.Notifications.h>
#include <winrt/Windows.Data.Xml.Dom.h>
@zupzup
zupzup / main.go
Created March 20, 2017 10:03
Go TCP Proxy / Port Forwarding Example (https://zupzup.org/go-port-forwarding/)
package main
import (
"flag"
"fmt"
"io"
"log"
"net"
"os"
"os/signal"
@scottcagno
scottcagno / cmdtimeout.go
Created May 27, 2016 18:47
Golang exec.Command Timeout Wrapper
package main
import (
"bytes"
"fmt"
"os/exec"
"time"
)
func run(timeout int, command string, args ...string) string {
@autosquid
autosquid / ThreadPool
Created October 21, 2014 06:11
ThreadPool with boost thread and asio
namespace bamthread
{
typedef std::unique_ptr<boost::asio::io_service::work> asio_worker;
// the actual thread pool
struct ThreadPool {
ThreadPool(size_t threads) :service(), working(new asio_worker::element_type(service)) {
for ( std::size_t i = 0; i < threads; ++i ) {
auto worker = boost::bind(&boost::asio::io_service::run, &(this->service));
g.add_thread(new boost::thread(worker));
}
@cdhunt
cdhunt / Get-CredentialFromWindowsCredentialManager.ps1
Last active September 4, 2024 19:46 — forked from toburger/Get-CredentialFromWindowsCredentialManager.ps1
Gets a PowerShell Credential [PSCredential] from the Windows Credential Manager. This only works for Generic Credentials.
<#
.SYNOPSIS
Gets a PowerShell Credential (PSCredential) from the Windows Credential Manager
.DESCRIPTION
This module will return a [PSCredential] object from a credential stored in Windows Credential Manager. The
Get-StoredCredential function can only access Generic Credentials.
Alias: GSC