These files are part of how I build a powershell profile.
This is what it looks like at startup:
#!/bin/sh | |
# Benjamin Collins <aggieben@gmail.com> | |
# Requires GNU readlink (get on macOS with `brew install coreutils`) | |
READLINK=${READLINK:-readlink} | |
cliPath=$(which dotnet) | |
netDir=$(dirname $($READLINK -f $cliPath)) | |
ls -1 "$netDir/sdk" |
// Inspired by http://bit.ly/juSAWl | |
// Augment String.prototype to allow for easier formatting. This implementation | |
// doesn't completely destroy any existing String.prototype.format functions, | |
// and will stringify objects/arrays. | |
String.prototype.format = function(i, safe, arg) { | |
function format() { | |
var str = this, len = arguments.length+1; | |
// For each {0} {1} {n...} replace with the argument in that position. If |
// select (LINQ Syntax) | |
var regions = | |
from r in Regions | |
where r.RegionID > 0 | |
select r; | |
regions.Dump(); | |
// insert | |
Region newRegion = new Region(){ | |
RegionID = 99, |
To setup your PowerShell to match mine, simply run the following commands:
# You may need to run this in an administrative PowerShell instance
Set-ExecutionPolicy Unrestricted
$SetupScript = Invoke-WebRequest https://gist.githubusercontent.com/notheotherben/77ccb460948afd826365e85d226509a7/raw/setup.ps1
$ScriptBlock = [ScriptBlock]::Create($SetupScript.Content)
Invoke-Command -ScriptBlock $ScriptBlock
[Unit] | |
Description=TeamCity Build Agent | |
After=network.target | |
[Service] | |
Type=forking | |
PIDFile=$AGENT_HOME/logs/buildAgent.pid | |
ExecStart=/usr/bin/sudo -u teamcity $AGENT_HOME/bin/agent.sh start | |
ExecStop=/usr/bin/sudo -u teamcity $AGENT_HOME/bin/agent.sh stop |
// Usage: | |
// Copy and paste all of this into a debug console window of the "Who is Hiring?" comment thread | |
// then use as follows: | |
// | |
// query(term | [term, term, ...], term | [term, term, ...], ...) | |
// | |
// When arguments are in an array then that means an "or" and when they are seperate that means "and" | |
// | |
// Term is of the format: | |
// ((-)text/RegExp) ( '-' means negation ) |
#!/bin/bash -e | |
# A SHORT DESCRIPTION OF YOUR SCRIPT GOES HERE | |
# USAGE: | |
# DESCRIPTION OF ENV VARS HERE | |
############################################################################### | |
set -e # exit on command errors (so you MUST handle exit codes properly!) | |
set -o pipefail # capture fail exit codes in piped commands | |
#set -x # execution tracing debug messages | |
# Get command info |
<# | |
.SYNOPSIS | |
Converts files to the given encoding. | |
Matches the include pattern recursively under the given path. | |
.EXAMPLE | |
Convert-FileEncoding -Include *.js -Path scripts -Encoding UTF8 | |
#> | |
function Convert-FileEncoding([string]$Include, [string]$Path, [string]$Encoding='UTF8') { | |
$count = 0 |
Roslyn provides a rich set of APIs for analyzing C# and Visual Basic source code, but constructing a context in which
to perform analysis can be challenging. For simple tasks, creating a Compilation
populated with SyntaxTrees
,
MetadataReferences
and a handful of options may suffice. However, if there are multiple projects involved in the
analysis, it is more complicated because multiple Compilations
need to be created with references between them.
To simplify the construction process. Roslyn provides the Workspace
API, which can be used to model solutions,
projects and documents. The Workspace
API performs all of the heavy lifting needed to parse SyntaxTrees
from source
code, load MetadataReferences
, and construct Compilations
and add references between them.