Skip to content

Instantly share code, notes, and snippets.

# Enable-RemoteDesktop
# Install-WindowsUpdate -Full
Update-ExecutionPolicy RemoteSigned
#cinst boxstarter
#cinst git
#cinst git-credential-winstore
cinst notepad2-mod
cinst 7zip
#cinst nodejs
import clr
clr.AddReference('CorDebug')
from System.Reflection import Assembly
ipy = Assembly.GetEntryAssembly().Location
import sys
py_file = sys.argv[1]
cmd_line = "\"%s\" -D \"%s\"" % (ipy, py_file)
from System.Threading import AutoResetEvent
@devhawk
devhawk / CustomCommands.cs
Created September 3, 2015 02:46
ASP.NET 5 CustomCommands runner
using System;
using System.Linq;
using System.Reflection;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Runtime;
namespace CustomCommands
{
public class Program
{
open System.IO
open System.Net
open System.Net.Sockets
open Microsoft.FSharp.Control
open Extensions
let rec relay_loop (http:HttpListener) (socket:Socket) =
async {
// Async.Any (http.AsyncGetContext(), socket.AsyncReceive())
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style>
.twitter_user
{
font-weight: bold;
}
#tweets
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
.twitter_user
{
font-weight: bold;
}
#tweets
@devhawk
devhawk / XML2JSON.js
Created May 3, 2012 23:02
simple utility function to convert XML to JSON using TreeWalker
function XML2JSON(doc) {
function workhorse(tw) {
var curNode = tw.currentNode;
if (curNode.nodeType === 3) {
return curNode.nodeValue;
}
var obj = {}
@devhawk
devhawk / ResolveNamespace.cs
Created June 11, 2012 18:07
P/Invoke and wrapper method for RoResolveNamespace
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
class WinRTInterop
{
public class ResolvedNamespaces
@devhawk
devhawk / gist:2913046
Created June 11, 2012 22:10
P/invoke for MetaDataGetDispenser
class WinRTInterop
{
public static IMetaDataDispenser GetMetadataDispenser()
{
var clsid = new Guid("{E5CB7A31-7512-11d2-89CE-0080C792E5D8}"); //CLSID_CorMetaDataDispenser
//var iid = new Guid("{31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3}"); //IID_IMetaDataDispenserEx
var iid = new Guid("{809C652E-7396-11D2-9771-00A0C9B4D50C}"); //IID_IMetaDataDispenser
object ppv;
var hr = MetaDataGetDispenser(clsid, iid, out ppv);
@devhawk
devhawk / gist:2915352
Created June 12, 2012 05:33
Portable IMetaDataImport p/invoke definition
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MetadataReader
{
using HRESULT = System.UInt32;