This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Powershell script for adding/removing/showing entries to the hosts file. | |
# | |
# Known limitations: | |
# - does not handle entries with comments afterwards ("<ip> <host> # comment") | |
# | |
$file = "C:\Windows\System32\drivers\etc\hosts" | |
function add-host([string]$filename, [string]$ip, [string]$hostname) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git functions for PowerShell | |
# Copyright 2009-2019 Mark Embling (http://www.markembling.info/) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy | |
# of this software and associated documentation files (the "Software"), to deal | |
# in the Software without restriction, including without limitation the rights | |
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
# copies of the Software, and to permit persons to whom the Software is | |
# furnished to do so, subject to the following conditions: | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# My preferred prompt for Powershell. | |
# Displays git branch and stats when inside a git repository. | |
# See http://gist.github.com/180853 for gitutils.ps1. | |
. (Resolve-Path ~/Documents/WindowsPowershell/gitutils.ps1) | |
function prompt { | |
$path = "" | |
$pathbits = ([string]$pwd).split("\", [System.StringSplitOptions]::RemoveEmptyEntries) | |
if($pathbits.length -eq 1) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function for determining current git branch (if any) | |
# Gracefully fails if not in a git repo and returns nothing. | |
__gitBranch() { | |
ref=$(git symbolic-ref HEAD 2> /dev/null) || return | |
echo ${ref#refs/heads/} | |
} | |
# Retrieves status information for git and places into predefined variables. | |
__gitStatus() { | |
# Initialise git status variables |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SSH Agent Functions | |
# Mark Embling (http://www.markembling.info/) | |
# | |
# How to use: | |
# - Place this file into %USERPROFILE%\Documents\WindowsPowershell (or location of choice) | |
# - Import into your profile.ps1: | |
# e.g. ". (Resolve-Path ~/Documents/WindowsPowershell/ssh-agent-utils.ps1)" [without quotes] | |
# - Enjoy | |
# | |
# Note: ensure you have ssh and ssh-agent available on your path, from Git's Unix tools or Cygwin. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mklink /D ".\WindowsPowershell" ".\My Dropbox\PowershellProfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Gets all items more expensive than £5. | |
var q = mongoContext.Query<Item>() | |
.Where(x => x.Price) | |
.IsGreaterThan(5); | |
// Gets all Smiths in the given cities. | |
var q2 = mongoContext.Query<Customer>() | |
.Where(x => x.Name).IsEqualTo("Smith") | |
.Where(x => x.City).IsIn("Bournemouth","Farnborough","London"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start the MongoDB server running (foreground) | |
function Start-MongoD { | |
$dropBox = (Resolve-Path '~\Documents\My Dropbox').Path | |
$mongoConfig = "$dropBox\Software\MongoDB\mongo.conf" | |
$mongoData = "$dropBox\Software\MongoDB\data\" | |
& $dropBox\Software\MongoDB\bin\mongod.exe --config "'$mongoConfig'" --dbpath "'$mongoData'" | |
} | |
# Start the MongoDB client app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Bb]in | |
[Oo]bj | |
*.suo | |
TestResult.xml | |
*.sln.cache | |
*.[Rr]e[Ss]harper.user | |
_ReSharper* | |
*.csproj.user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This would (does) work in proper browsers. | |
jQuery(createElement('form')) | |
.attr({'method':'post','action':/*some url*/}) | |
.submit(); | |
// IE needs it to be attached to the document somewhere first before submission will work. :( | |
var f = jQuery(createElement('form')) | |
.attr({'method':'post','action':/*some url*/}); | |
jQuery('body').append(f); | |
f.submit(); |
OlderNewer