service now helper scripts for automating some common tasks in the browser as bookmarklets
these are only tested and used with chrome currently
service now helper scripts for automating some common tasks in the browser as bookmarklets
these are only tested and used with chrome currently
| / | |
| --/assets | |
| ----/page1 | |
| ------20180101-Some Document Title-t0.pdf | |
| ------20180102-Some Document Title-t0.pdf | |
| ------20180104-Some Document Title-t1.pdf | |
| page1.md |
| # 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 |
| $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..." | |
| } |
| $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(',') |
| <?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> |
| # 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" |
| # 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 |
| 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 |
| 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(); |