Skip to content

Instantly share code, notes, and snippets.

View cobalthex's full-sized avatar
💭
maybe?

cobalthex

💭
maybe?
View GitHub Profile
@vaualbus
vaualbus / .cpp
Created September 9, 2018 16:17
This file replace the msvc CRT and allow you to init static variables and TLS
#if _CRT_DISABLE
extern "C" int _fltused = 0x9875;
#define WIN32_LEAN_AND_MEAN
#include <stdint.h>
#include <limits.h>
#include <windows.h>
//#include <Windows.h>
@pmolchanov
pmolchanov / PoshWebHarness.ps1
Created June 18, 2015 17:13
Simple PowerShell HTTP/HTTPS web server useful for mocking web services
# Use the following commands to bind/unbind SSL cert
# netsh http add sslcert ipport=0.0.0.0:443 certhash=3badca4f8d38a85269085aba598f0a8a51f057ae "appid={00112233-4455-6677-8899-AABBCCDDEEFF}"
# netsh http delete sslcert ipport=0.0.0.0:443
$HttpListener = New-Object System.Net.HttpListener
$HttpListener.Prefixes.Add("http://+:80/")
$HttpListener.Prefixes.Add("https://+:443/")
$HttpListener.Start()
While ($HttpListener.IsListening) {
$HttpContext = $HttpListener.GetContext()
$HttpRequest = $HttpContext.Request
@ciphertxt
ciphertxt / GetBitsTransferProgress.ps1
Created March 18, 2014 01:57
Progress bar for current "Transferring" BITS Transfers with a time remain calculation.
while ((Get-BitsTransfer | ? { $_.JobState -eq "Transferring" }).Count -gt 0) {
$totalbytes=0;
$bytestransferred=0;
$timeTaken = 0;
foreach ($job in (Get-BitsTransfer | ? { $_.JobState -eq "Transferring" } | Sort-Object CreationTime)) {
$totalbytes += $job.BytesTotal;
$bytestransferred += $job.bytestransferred
if ($timeTaken -eq 0) {
#Get the time of the oldest transfer aka the one that started first
$timeTaken = ((Get-Date) - $job.CreationTime).TotalMinutes