Skip to content

Instantly share code, notes, and snippets.

alias pullahillary='rm -rf'
# This can help you detect which shortcuts from IE are internal or external
# you may want to migrate/backup/sync https://gist.github.com/pohatu but not
# something like http://secret/internal/site
# madprops to madprops for below snippet
#http://madprops.org/blog/list-your-favorites-in-powershell/
$favs = gci $env:userprofile\favorites -rec -inc *.url |
? {select-string -inp $_ -quiet "^URL=http"} |
select @{Name="Name"; Expression={[IO.Path]::GetFileNameWithoutExtension($_.FullName)}},
@pohatu
pohatu / AddDiskCleanupScheduledTask.ps1
Last active August 29, 2015 14:01
Run Disk Cleanup with your settings on a weekly cadence
# Automatically Run Disk Clean-Up Utility With Preferred Settings
# Windows 8.1/2012 R2; Powershell 4.0
# First, launch CleanMgr.EXE with /sageset: n - where n is some number (defaults to 5000)
# You will need to set the settings as you desire in the UI that appears
# When you save, it will save the settings in a regkey
# for more information, see http://support.microsoft.com/kb/315246
#
# The n value, which is stored in the registry, allows you to specify tasks for Disk Cleanup to run.
# The n value can be any integer value from 0 to 65535.
# EchoArgs.ps1 is a PowerShell script that compiles EchoArgs.cs code into EchoArgs.exe
# The Add-Type command is used to generate this CS code.
# EchoArgs.exe will be in $env:temp\EchoArgs.exe
# EchoArgs.cs Source Code via Keith Hill
# From PSCX - Power Shell Community Extensions
# URL: http://pscx.codeplex.com/SourceControl/latest#Trunk/Src/EchoArgs/EchoArgs.cs
# LicenseURL: http://pscx.codeplex.com/license
$EchoArgs_CS = @"
@pohatu
pohatu / gow.json
Last active August 29, 2015 14:00
{
"homepage": "https://github.com/bmatzelle/gow/archive",
"version": "0.2014.5.5",
"url": "https://github.com/bmatzelle/gow/archive/master.zip",
"hash":"12c527edbff9c90fed4b7cc5168b2ba1b64cc57ce4b12d79f2bcd40c2839d36b",
"extract_dir": "gow-master/bin",
"bin": [
"awk.exe",
"basename.exe",
"bash.exe",
{
"homepage": "http://xhmikosr.github.io/notepad2-mod/",
"license": "BSD",
"version": "4.2.25.906",
"architecture": {
"64bit": {
"url": "https://github.com/XhmikosR/notepad2-mod/releases/download/4.2.25.906/Notepad2-mod.4.2.25.906_x64.zip"
},
"32bit": {
@pohatu
pohatu / FizzBuzz.PEG.js
Last active August 29, 2015 14:00
FizzBuss.PEG.js
/*
* FizzBuzz as a PEG Parser
* This is the grammar to input to PEG.JS
* Output is a JS Parser that will recognize numbers and convert them to:
* "fizz" if multiples of 3, "buzz" if multiples of 5, and "fizzbuzz" if multiples of 3 and 5.
* Using predicates, I was able to get this to actually create fizz, buzz, and fizzbuzz tokens! Woo! Hoo!
*/
start
[Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Interop.PowerPoint")
[Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[string] $Source = "$(Split-Path $Script:MyInvocation.MyCommand.Path -Parent)\Slide.html"
[int] $DefaultTitleHeight = 150
function Add-Textbox {
param (
[object] $Slide,
[string] $Text,
@pohatu
pohatu / ConvertTo-MarkDownTable.ps1
Last active August 29, 2015 13:59
ConvertTo-MarkDownTable
function ConvertTo-MarkDownTable()
{
$in = [windows.clipboard]::GetText()
$lines = $in.split("`n")
$out=@()
$out += $lines[0] -replace "`r",'' -replace "^","|" -replace ",","|" -replace "$","|`n"
$out += $lines[0] -replace "`r",'' -replace "\w+","---" -replace "^","|" -replace ",","|" -replace "$","|`n"
$out += $lines[1..($lines.Count-1)] -replace "`r", '' -replace "^", "|" -replace ",","|" -replace "$", "|`n"
@pohatu
pohatu / fizzbuzz.ps1
Created April 14, 2014 08:19
fizzbuzz in 66 characters
1..100|%{"fizz"*!($_%3)+"buzz"*!($_%5)+"$_"*!(!($_%3)-or!($_%5));}