Skip to content

Instantly share code, notes, and snippets.

View BackupScriptForTony.bat
@echo off
setlocal
:: <config>
:: CONFIGURATION STUFF BELOW
:: Base folder where the new sub-folders will be created. Do NOT include a trailing slash [eg, c:\temp is ok, but not c:\temp\]
set "baseDir=C:\TEMPOUTPUT"
:: The second destination to recieve a copy of these files
set "baseDir2=C:\TEMPOUTPUT2"
@aplocher
aplocher / ClearVisualStudioExpHive.ps1
Created Feb 25, 2015
Powershell script to list or remove Visual Studio hives
View ClearVisualStudioExpHive.ps1
param (
[string]$fullName = "", # Example: "12.0Exp" is VS v12.0 (2013) hive name "Exp"
[switch]$listHives = $false,
[switch]$force = $false
)
$vsAppDataRoot = Join-Path $env:APPDATA "Microsoft\VisualStudio"
$vsRegKeyRoot = "hkcu:\Software\Microsoft\VisualStudio"
if (-not $fullName -and -not $listHives) {
@aplocher
aplocher / clapper.py
Last active Mar 17, 2017
Python script to detect signal from MAX4466 Mic Amp and send an RF signal to power on/off a plug when it detects two clap sounds (aka "DIY The Clapper"). Implemented on Raspberry Pi Zero
View clapper.py
#!/usr/bin/python
#
# usage: clapper.py [-h] [--on | --off]
#
# With no arguments, this will run continuously and listen for clap noises to
# trigger an RF power plug to turn on or off (aka The Clapper). Can
# alternatively be used to manually control a power plug with arguments
#
# optional arguments:
# -h, --help show this help message and exit
@aplocher
aplocher / setup_mssql.ps1
Created Jan 21, 2017 — forked from DamianZaremba/setup_mssql.ps1
MSSQL Server Setup - designed to be run via ssh, ie vagrant under opentable/win-2012r2-standard-amd64-nocm
View setup_mssql.ps1
$ErrorActionPreference = "Stop"
$client = new-object System.Net.WebClient
# Reset vagrant password so it's not expired
([adsi]"WinNT://vagrant-2012-r2/vagrant").SetPassword("P@55w0rd!")
# Setup UAC wrapper ;(
if(!(Test-Path -Path "C:\uacts_x64.zip")) {
Write-Output "Setting up UAC wrapper"
$client.DownloadFile("http://www.itknowledge24.com/files/uacts_x64.zip", "C:\uacts_x64.zip")
@aplocher
aplocher / GStreamer-1.0 some strings.sh
Created Sep 20, 2016 — forked from strezh/GStreamer-1.0 some strings.sh
GStreamer-1.0 personal cheat sheet
View GStreamer-1.0 some strings.sh
#!/bin/bash
# play YUV444 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
videoparse width=1920 height=1080 framerate=25/1 format=GST_VIDEO_FORMAT_Y444 ! \
videoconvert ! \
autovideosink
# play YUV422 FULL HD file
gst-launch-1.0 -v filesrc location=size_1920x1080.yuv ! \
@aplocher
aplocher / FixSynaptics.bat
Created May 22, 2016
Since upgrading to Windows 10 the Synaptics driver will occasionally become unstable (specifically when explorer.exe dies) and cause the mouse cursor to lock up for a few seconds every couple of minutes. I've experienced this on my HP Elitebook 8470p and Elitebook 840G2, but it's likely occuring on any laptop with a Synaptics touch pad in Win10.…
View FixSynaptics.bat
@echo off
rem FOR RESETTING SYNAPTICS MOUSE DRIVER
rem HELPFUL FOR WHEN MOUSE REGULARLY FREEZES AFTER EXPLORER.EXE HANGS
rem OR SCROLL/GESTURES STOP WORKING RANDOMLY
taskkill -f -im syntpenh.exe
pushd C:\Program Files\Synaptics\SynTP
start "" "syntpenh.exe"
popd
timeout /t 2 /nobreak >nul
exit /b
@aplocher
aplocher / Backup.bat
Last active Apr 26, 2016
Sync two folders using VSS. Handy for syncing source code with a backup destination on OneDrive
View Backup.bat
@echo off & setlocal enabledelayedexpansion
:: Backup.bat:
:: Adam Plocher - gist.github.com/aplocher - bitcollectors.com
::
:: --Description:
:: Synchronize (backup) a directory to another dir using VSS (volume shadow copy
:: service) in Windows to help ensure a successful copy without locked files
:: impeding the process.
::
:: Can be called from command line or can be used to install a scheduled task
@aplocher
aplocher / ArpHosts.ps1
Created Jan 11, 2016
Output based on (and similar to) arp -a, but includes hostnames. Will take a few seconds longer to run since it must reverse resolve each IP.
View ArpHosts.ps1
$hostColWidth = 40
arp -a | % {
$line=$_.ToString().Trim()
try {
if ($line -like "Interface:*" -or $line -eq "") {
$line
} elseif ($line -like "Internet Address*") {
" " + "HostName".PadRight($hostColWidth, ' ') + $line
} else {
$res=[System.Net.Dns]::gethostentry($line.ToString().Trim().Split(" ")[0])
@aplocher
aplocher / WindowsToolbarAutomation.ahk
Created Aug 31, 2015
AutoHotKey script to automate adding a toolbar to the taskbar in Windows
View WindowsToolbarAutomation.ahk
; Automates adding a toolbar to the taskbar in Windows
#SingleInstance force
; Change to the folder path to your toolbar
toolbarPath=OneDrive\System\Actions
ControlGet, handle, Hwnd,, TrayClockWClass1,,Notification Area
ControlClick, ,ahk_id %handle% ,,Right
WinWait,ahk_class #32768,,5
if ErrorLevel
@aplocher
aplocher / BackupDismFeatures.ps1
Created Aug 22, 2015
Small PowerShell script that looks at the currently installed Windows Features on the current system and generates a dism.exe/ cmd.exe command to be used to restore those features. Handy for when you're reinstalling Windows on a machine and want to backup / restore your IIS, Hyper-V, etc configuration.
View BackupDismFeatures.ps1
$o=$nothing
Get-WindowsOptionalFeature -Online | where State -eq Enabled | %{$o += ("/FeatureName:"+$_.FeatureName+" ")}
Write-Host "dism.exe /Online /Enable-Feature $o/All"