PowerShell:
cat Temp\dashboard-plus-reset-filters-to-default-plus-turn-off-one-cascading-filter.json `
| Select-String '"count": [0-9]+' `
| select -expand Matches `
| % {$_.Value} `
| sort `
| gu| Physical display pixels/in. = # of pixels on diagonal / diagonal size of monitor | |
| e.g., Phililps PHL 346B1C is a 34" ultra-wide at 3440x1440 | |
| PowerShell: | |
| > $d = 3440*3440 + 1440*1440 | |
| > [Math]::Sqrt($d) # Pixels on the diagnoal | |
| > [Math]::Sqrt($d)/34 # Pixels/in., matches manufacturer claim of 110 ppi. |
| I usually UNCHECK the "treat as alias" checkbox | |
| server: smtp.gmail.com (no "@", dummy) | |
| user: [email protected] | |
| password: app password from google acct mgmt ("security/sign on") | |
| yay, google sends you a verification email | |
| $passwd = ConvertTo-SecureString 'hunter2' -AsPlainText -Force | |
| [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($passwd)) | |
| # Another way to get the password in w/out putting it in a command line as above. | |
| $passwd = Read-Host -AsSecureString | |
| [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($passwd)) | |
| $bytes = (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) | |
| $bytes.length # Should be 16 |
| $grafana = "http://yerhost:3000" | |
| $headers = @{ Accept = "application/json"; Authorization = "Bearer yerApiKey" } | |
| # This is how you get your timezone handled properly. Also, this lovely .ToUnixTimeMilliseconds() is just the ticket. | |
| # | |
| $timeEpoch = (new-object DateTimeOffset -ArgumentList $(get-date)).ToUnixTimeMilliseconds() | |
| # Panel id is optional. | |
| # |
PowerShell:
cat Temp\dashboard-plus-reset-filters-to-default-plus-turn-off-one-cascading-filter.json `
| Select-String '"count": [0-9]+' `
| select -expand Matches `
| % {$_.Value} `
| sort `
| gu| # Use to create local host, server javascript modules w/the correct mimetime. | |
| # See https://stackoverflow.com/a/60638762 | |
| # | |
| import http.server | |
| import socketserver | |
| PORT = 8080 | |
| Handler = http.server.SimpleHTTPRequestHandler | |
| Handler.extensions_map.update({ |
| version: 1 | |
| formatters: | |
| # Note that the following formats may use the 'hostname' attribute, which is non-standard. Be sure to use an adapter | |
| # or a filter to get that info into the LogRecord context or ugliness will result. | |
| # See: | |
| # - mem_cleaner2.HostnameLoggerAdapter | |
| # - https://docs.python.org/3/howto/logging-cookbook.html#adding-contextual-information-to-your-logging-output | |
| # | |
| oneLine: |
| <section class="wrapper"> | |
| <div class="spinner"> | |
| <i></i> | |
| <i></i> | |
| <i></i> | |
| <i></i> | |
| <i></i> | |
| <i></i> | |
| <i></i> | |
| </div> |
| ; For use in editing files of programming languages that don't have "current line number" functions. | |
| ; Looking at you, k6.io. | |
| ; Include in macro or defun, obviously. | |
| (insert (format "%d" (line-number-at-pos))) |
| # PS S:\JLusk\Play\k6> python | |
| # Python 3.8.3 (tags/v3.8.3:6f8c832, May 13 2020, 22:37:02) [MSC v.1924 64 bit (AMD64)] on win32 | |
| # Type "help", "copyright", "credits" or "license" for more information. | |
| from datetime import * | |
| dt = datetime.fromtimestamp(1594396899) | |
| dt.strftime( "%c") | |
| # 'Fri Jul 10 12:01:39 2020' | |
| quit() |