Skip to content

Instantly share code, notes, and snippets.

View maniacalhamster's full-sized avatar
💭
💻 🦐

Akar Singh maniacalhamster

💭
💻 🦐
  • San Diego Supercomputer Center
  • LinkedIn in/aks002
View GitHub Profile
@19WAS85
19WAS85 / powershell-web-server.ps1
Last active November 4, 2024 16:50
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@cdhunt
cdhunt / map_fold.ps1
Created October 27, 2016 13:55
Map and Fold implementations in Powershell
function map([scriptblock]$map, [Collections.IEnumerable]$x, $y) { $x.ForEach({& $map $_ $y}) }
# Two parameters
map { param($x, $y) $x + $y } @(1,2,3) 10
# Anonymous function as a value
$squareIt = { param($x) $x + $x }
map $squareIt @(1,2,3)
# One parameter
@scottgulliver
scottgulliver / checkout_branches.ps1
Created January 31, 2018 12:03
Powershell script to checkout all remote git branches
git branch -r | Select-String -Pattern "->" -NotMatch | Select-String -pattern "^ origin/" | foreach { $_ -replace '^ origin/', '' } | Foreach { git checkout $_ }