Skip to content

Instantly share code, notes, and snippets.

@dylanmei
dylanmei / gist:6026331
Last active December 19, 2015 22:19
my git-ps1-bash-prompt
# Reset
Color_Off="\[\033[0m\]"
# Regular Colors
Black="\[\033[0;30m\]"
Red="\[\033[0;31m\]"
LightRed="\[\033[1;31m\]"
Green="\[\033[0;32m\]"
LightGreen="\[\033[1;32m\]"
Brown="\[\033[0;33m\]"
Yellow="\[\033[1;33m\]"
@dylanmei
dylanmei / gist:6511294
Created September 10, 2013 15:41
ASPX Server Variables
<%@ Page language="C#" %>
<html>
<body>
<table border="1">
<tr>
<td><b>Server Variable</b></td>
<td><b>Value</b></td>
</tr>
<% foreach (string strKey in Request.ServerVariables) { %>
@dylanmei
dylanmei / sublime-notepad-replacement
Created September 13, 2013 19:02
Windows Notepad replacement, in this case, sublime
1. Create an executable
using System.Collections.Generic;
using System.Diagnostics;
namespace Sublime_ifeo
{
class Program
{
static void Main(string[] args)
{
Process.Start(@"C:\Program Files\Sublime Text 2\sublime_text.exe",
@dylanmei
dylanmei / extract ms packages
Last active October 10, 2022 00:04
How to extract msu/msp/msi/exe files from the command line
http://www.windowswiki.info/2009/02/19/how-to-extract-msumspmsiexe-files-from-the-command-line/
I find these commands quite helpful — maybe you know them already — if not, here you go:
Microsoft Hotfix Installer (.exe)
setup.exe /t:C:<target_dir> /c
Microsoft Update Standalone Package (.msu)
expand -F:* update.msu C:<target_dir>
cd <target_dir>
@dylanmei
dylanmei / List Windows hotfixes
Created October 2, 2013 02:29
List Windows hotfixes installed after a specified date
12:35 C:\> Get-HotFix | ? installedon -gt 1/15/2013
Source Description HotFixID InstalledBy InstalledOn
------ ----------- -------- ----------- -----------
EDLT Update KB2803748 NT AUTHORITY\SYSTEM 1/22/2013 12:00...
@dylanmei
dylanmei / packer-windows-openssh-5.3
Created October 4, 2013 19:27
Output from Packer building Windows 2012 / VirtualBox with OpenSSH for Windows 5.3
2013/10/02 22:47:47 Packer Version: 0.3.9
2013/10/02 22:47:47 Packer Target OS/Arch: darwin amd64
2013/10/02 22:47:47 Detected home directory from env var: /Users/dylanmei
2013/10/02 22:47:47 Attempting to open config file: /Users/dylanmei/.packerconfig
2013/10/02 22:47:47 File doesn't exist, but doesn't need to. Ignoring.
2013/10/02 22:47:47 Packer config: &{PluginMinPort:0 PluginMaxPort:0 Builders:map[amazon-ebs:packer-builder-amazon-ebs amazon-chroot:packer-builder-amazon-chroot amazon-instance:packer-builder-amazon-instance digitalocean:packer-builder-digitalocean openstack:packer-builder-openstack virtualbox:packer-builder-virtualbox vmware:packer-builder-vmware] Commands:map[build:packer-command-build fix:packer-command-fix inspect:packer-command-inspect validate:packer-command-validate] PostProcessors:map[vagrant:packer-post-processor-vagrant] Provisioners:map[chef-solo:packer-provisioner-chef-solo file:packer-provisioner-file puppet-masterless:packer-provisioner-puppet-masterless shell:packer-provisi
@dylanmei
dylanmei / WinRM in Go
Created November 17, 2013 17:15
WinRM's equivalent of Hello World in Go, from the XML sample in on the front page of MSDN's WS-Management documentation.
package main
import (
"bytes"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
"net/http"
)
@dylanmei
dylanmei / gist:7914583
Created December 11, 2013 17:18
packer-windows - sshd_config - circa november
# $OpenBSD: sshd_config,v 1.89 2013/02/06 00:20:42 dtucker Exp
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/bin:/usr/sbin:/sbin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
@dylanmei
dylanmei / csv-to-json
Created March 25, 2014 13:50
CSV to JSON in Groovy
import groovy.json.*
if (args.size() == 0) {
println("missing argument")
System.exit(1)
}
def f = new File(args[0])
if (!f.exists()) {
println("file doesn't exist")
@dylanmei
dylanmei / vimrc
Created April 1, 2014 22:32
vimrc
execute pathogen#infect()
Helptags
set background=dark
set encoding=utf-8
set backupdir=~/tmp
" http://vim.wikia.com/wiki/Mac_OS_X_clipboard_sharing
set clipboard=unnamed