Skip to content

Instantly share code, notes, and snippets.

View 0xbrock's full-sized avatar

Brock 0xbrock

View GitHub Profile
#
# Generates a new cert in a .pfx file
#
param(
[Parameter(Mandatory = $true)]
$Name,
[Parameter(Mandatory = $true)]
$Password,
$Duration = 120
public class Encrypted {
public string Value { get; set; }
public string Salt { get; set; }
}
@lukas-h
lukas-h / license-badges.md
Last active July 25, 2024 22:25
Markdown License Badges for your Project

Markdown License badges

Collection of License badges for your Project's README file.
This list includes the most common open source and open data licenses.
Easily copy and paste the code under the badges into your Markdown files.

Notes

  • The badges do not fully replace the license informations for your projects, they are only emblems for the README, that the user can see the License at first glance.

Translations: (No guarantee that the translations are up-to-date)

@rsgoheen
rsgoheen / gist:ba5fb610396b09e4481e
Created February 27, 2015 13:44
Using Serilog in a PowerShell script
Add-Type -Path "Serilog.dll"
Add-Type -Path "Serilog.Sinks.Seq.dll"
Add-Type -Path "Serilog.Sinks.EventLog.dll"
Add-Type -Path "Serilog.FullNetFx.dll"
Add-Type -Path "Serilog.Extras.AppSettings.dll"
Add-Type -Path "Serilog.Extras.Timing.dll"
$Config = New-Object Serilog.LoggerConfiguration
[Serilog.Configuration.LoggerSinkConfiguration]$ConfigSink = $config.WriteTo
[Serilog.Log]::Logger = [Serilog.LoggerConfigurationFullNetFxExtensions]::RollingFile($ConfigSink, "C:\Logs\Log-{Date}.txt", ([Serilog.Events.LogEventLevel]::Verbose), "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] {Message}{NewLine}{Exception}", $null, 10000000, 15).CreateLogger()
@SidShetye
SidShetye / HardenSSL.ps1
Last active August 14, 2023 14:59
Script to harden SSL/TLS on Azure Cloud Service
# Call this from inside a startup task/batch file as shown in the next two lines (minus the '# ')
# PowerShell -ExecutionPolicy Unrestricted .\HardenSsl.ps1 >> log-HardenSsl.txt 2>&1
# EXIT /B 0
# Credits:
# http://azure.microsoft.com/blog/2014/10/19/how-to-disable-ssl-3-0-in-azure-websites-roles-and-virtual-machines/
# http://lukieb.blogspot.com/2014/11/tightening-up-your-azure-cloud-service.html
$nl = [Environment]::NewLine
$regkeys = @(
@staltz
staltz / introrx.md
Last active July 26, 2024 04:24
The introduction to Reactive Programming you've been missing
@jdx
jdx / boot.js
Last active March 16, 2023 18:08
zero-downtime node.js app runner
// This script will boot app.js with the number of workers
// specified in WORKER_COUNT.
//
// The master will respond to SIGHUP, which will trigger
// restarting all the workers and reloading the app.
var cluster = require('cluster');
var workerCount = process.env.WORKER_COUNT || 2;
// Defines what each worker needs to run
@jbtule
jbtule / AESGCM.cs
Last active July 19, 2024 19:09
I have two code examples that I wrote for best practices encrypting a string in c#. They are both using authenticated encryption. http://stackoverflow.com/a/10366194/637783
/*
* This work (Modern Encryption of a String C#, by James Tuley),
* identified by James Tuley, is free of known copyright restrictions.
* https://gist.github.com/4336842
* http://creativecommons.org/publicdomain/mark/1.0/
*/
using System;
using System.IO;
using System.Text;
@ecampidoglio
ecampidoglio / Out-Diff.ps1
Created January 18, 2012 21:48
A PowerShell function to colorize a sequence of text lines that represent an Universal Diff. For more information, see http://megakemp.com/2012/01/19/better-diffs-with-powershell/
function Out-Diff {
<#
.Synopsis
Redirects a Universal DIFF encoded text from the pipeline to the host using colors to highlight the differences.
.Description
Helper function to highlight the differences in a Universal DIFF text using color coding.
.Parameter InputObject
The text to display as Universal DIFF.
#>
[CmdletBinding()]
@paulirish
paulirish / data-markdown.user.js
Last active February 6, 2024 10:41
*[data-markdown] - use markdown, sometimes, in your HTML
// ==UserScript==
// @name Use Markdown, sometimes, in your HTML.
// @author Paul Irish <http://paulirish.com/>
// @link http://git.io/data-markdown
// @match *
// ==/UserScript==
// If you're not using this as a userscript just delete from this line up. It's cool, homey.