Skip to content

Instantly share code, notes, and snippets.

@jacqinthebox
jacqinthebox / Scrambler.cs
Created October 28, 2013 19:34
Password Scrambler
using System;
using System.Xml;
using System.Security.Cryptography;
using System.IO;
using System.Text;
namespace PasswordEncrypt
{
public class Scrambler
static void Main(string[] args) {
var text = File.ReadAllLines(@"C:\Users\jpor01\dev\grh.txt");
var file = new StreamWriter(@"C:\Users\jpor01\dev\grh-out.txt", true);
foreach (string line in text)
{
var pattern = Regex.IsMatch(line, @"\b(0x00000005)\b", RegexOptions.IgnoreCase );
if (pattern == true)
var gulp = require('gulp');
var browserSync = require('browser-sync');
var uglify = require('gulp-uglify');
var concat = require('gulp-concat');
var notify = require('gulp-notify');
var nodemon = require('gulp-nodemon');
// we'd need a slight delay to reload browsers
// connected to browser-sync after restarting nodemon
var BROWSER_SYNC_RELOAD_DELAY = 500;
@jacqinthebox
jacqinthebox / gist:904919151f3d0df73e28
Last active September 12, 2017 09:38
Download all proxy addresses from AD #exchange
public void getAllProxyAddresses()
{
var db = new UMTDataContext();
PrincipalContext AD = new PrincipalContext(ContextType.Domain, this.MailDomain);
UserPrincipal u = new UserPrincipal(AD);
PrincipalSearcher search = new PrincipalSearcher(u);
List<string> emailAddresses = new List<string>();
#works with SQL Server 2016 Express & Visual Studio 2015 Community
New-Item 'c:\temp' -ItemType Directory -Force
Set-Location C:\temp
choco install 7zip.commandline --yes --force
wget https://msftdbprodsamples.codeplex.com/downloads/get/880661# -OutFile adventureworksdb.zip
7z e .\adventureworksdb.zip
#assuming SQL 2016
$env:PSModulePath = $env:PSModulePath + ";C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules"
#works with SQL Server 2016 Express
Set-ExecutionPolicy Bypass
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | iex
choco install sql-server-express -force -yes
$env:PSModulePath = $env:PSModulePath + ";C:\Program Files (x86)\Microsoft SQL Server\130\Tools\PowerShell\Modules"
Import-Module SQLPS
New-Item 'c:\temp' -ItemType Directory -Force
@jacqinthebox
jacqinthebox / Vagrantfile.rb
Last active September 20, 2017 11:43
Vagrantfile for Paralells #vagrant
# -*- mode: ruby -*
# vi: set ft=ruby
$hostfile = <<HOSTFILE
Add-Content $ENV:windir\\System32\\drivers\\etc\\hosts "192.168.56.3 `t `t chefserver.dev.local"
Add-Content $ENV:windir\\System32\\drivers\\etc\\hosts "192.168.56.3 `t `t chefserver"
netsh advfirewall set allprofiles state off
HOSTFILE
Vagrant.configure(2) do |config|
@jacqinthebox
jacqinthebox / json.json
Last active September 20, 2017 11:45
Well formatted json #json
{
"serviceBusNamespaces": {
"messaging" : [{
"suffix": "messaging",
"skuName": "Standard",
"messages": [
{
"type": "queue",
"name": "eventtrackingprocessing",
@jacqinthebox
jacqinthebox / azuredeploy.json
Created September 24, 2017 16:11
ARM Template with copyindex #arm #azure
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"Hostheader": {
"type": "string",
"defaultValue": "servicebus.customername.org",
"metadata": {
"description": "Add the hostheader for the BizTalk Webservice"
}
@jacqinthebox
jacqinthebox / powershell.md
Last active October 25, 2017 14:51
Powershell best practice (for me) in PowerShell #powershell

Powershell Patterns I use

Function Outline

Function New-PowershellFunction 
{
  [CmdletBinding()] 
  param(
    [Parameter(Mandatory = $true,
    ValueFromPipelineByPropertyName = $true)]