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
/ | |
--/assets | |
----/page1 | |
------20180101-Some Document Title-t0.pdf | |
------20180102-Some Document Title-t0.pdf | |
------20180104-Some Document Title-t1.pdf | |
page1.md |
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
# note that this is not a shell script that is meant to be run, just a list of shell commands mostly with comments. | |
# I am setting this up on my mac so all commands will be relative to that | |
# 1. Setup the piholes as usual, download stretch lite, image sdcard with etcher | |
# start with the following link if you forgot: | |
# https://www.raspberrypi.org/downloads/raspbian/ | |
# 2. enable ssh | |
touch /Volumes/boot/ssh |
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
$a = "server" | |
$b = "\Processor(_Total)\% Processor Time" | |
Get-Counter -com $a -cou $b -s 1 -con | %{ | |
$cv = [math]::round($_[0].CounterSamples.CookedValue) | |
Write-Progress -Activity $a ` | |
-PercentComplete $cv ` | |
-CurrentOperation "$b - $cv%" ` | |
-Status "Measuring..." | |
} |
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
$sb = { | |
(New-Object -ComObject Microsoft.Update.Session).CreateUpdateSearcher() | %{ | |
$_.QueryHistory(0, $_.GetTotalHistoryCount()) | | |
? resultcode -in 2,3 | | |
? operation -eq 1 | | |
select title,date -unique | | |
%{ [pscustomobject]$_ } | |
} | |
} | |
$s = "s1,s2,s3,s4".split(',') |
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
<?xml version="1.0"?> | |
<settings> | |
<mail> | |
<from>from@gmail.com</from> | |
<to>to@gmail.com</to> | |
<subject>Test</subject> | |
<smtp>smtp.gmail.com</smtp> | |
<port>587</port> | |
<user>from@gmail.com</user> | |
<pass>frompassword</pass> |
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
# all files | |
$a = Get-Item *.txt | |
# prefix of latest file | |
$b = $a | | |
sort -Property LastWriteTime -Descending | | |
select -First 1 @{n='dts';e={$_.name.split('_')[0]}}).dts | |
# files with that prefix | |
Get-Item "$b*.txt" |
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
# Long way with some explanation | |
$FilePath = "path_to_ file" | |
$FileContents = gc $FilePath | |
$Commas = $FileContents[0].Split(',').Count | |
$Columns = $Commas + 1 | |
$Header = (1..$Columns|%{"f{0,2:00}" -f $_}) | |
$Data = $FileContents | ConvertFrom-Csv -Header $Header | |
$Data | Format-Table * | |
# What I usually do is something more like |
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
select | |
[job] = j.name | |
, s.step_id | |
, [step] = s.step_name | |
, [cmd] = s.command | |
, [db] = s.database_name | |
from | |
sysjobs j | |
join sysjobsteps s on | |
s.job_id = j.job_id |
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
void Main() | |
{ | |
//function to measure an actions execution time | |
Func<Action,int,TimeSpan> ma = (m,c) =>{ | |
Stopwatch s = new Stopwatch(); | |
s.Start(); | |
for (int i = 0; i < c; i++) | |
m(); | |
s.Stop(); |
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
Sub FWAP() | |
Dim OriginalPage As Visio.Page | |
Set OriginalPage = ActivePage | |
Dim PagObj As Visio.Page | |
For Each PagObj In ActiveDocument.Pages | |
ActiveWindow.Page = PagObj.Name | |
ActiveWindow.ViewFit = visFitPage | |
Next PagObj |