This file contains hidden or 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
| import requests | |
| import isodate # To parse ISO 8601 durations | |
| # Create an API key in Google Cloud: API/Service Details/Credentials | |
| API_KEY = 'mykey' | |
| VIDEO_IDS = [ | |
| 'KZSD3lauzDo', 'puddZhRgRNI', 'YJTjtoKGCYo', '-PjtJeMvsFI', 'KZSD3lauzDo', | |
| 'puddZhRgRNI', 'YJTjtoKGCYo', '-PjtJeMvsFI', 'KZSD3lauzDo', 'puddZhRgRNI', | |
| 'YJTjtoKGCYo', '-PjtJeMvsFI' | |
| ] |
This file contains hidden or 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
| # Tested on Ubuntu, use 'apt-get install jq' | |
| cat ./bookmarks.json | jq '.. | select(.type?=="text/x-moz-place") | "\(.title?), \(.uri)"?' | |
| cat ./bookmarks.json | jq -r '.. | select(.type?=="text/x-moz-place") | "- [\(.title?)](\(.uri?))"' > uris.md | |
| # The second prints a markdown file using the title and uri |
This file contains hidden or 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
| while ($true) { $r = wget -uri "http://somesite.com?q=1" -headers @{"Accept-Tenant"="Nz"}; echo $r.Content } |
This file contains hidden or 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
| # choco install -y jq | |
| # npm install --global fast-cli | |
| while ($true) | |
| { | |
| $now = date; | |
| $dateRow = $now.ToString("dd-MM-yyyy HH:mm"); | |
| $dl = fast -u --json | jq '.downloadSpeed'; | |
| echo "$dateRow, $dl" >> data.txt; |
This file contains hidden or 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
| using Microsoft.AspNetCore.Mvc; | |
| using Microsoft.Extensions.Logging; | |
| using System; | |
| using System.Collections.Generic; | |
| using System.Diagnostics; | |
| using System.Linq; | |
| using System.Net.Http; | |
| using System.Threading.Tasks; | |
| using TestCircuitBreaker.Models; |
This file contains hidden or 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
| // See https://github.com/dotnet/runtime/issues/23749 | |
| public static class CertHelper | |
| { | |
| // To generate a self-signed cert: | |
| // dotnet dev-certs https -ep $pwd/selfsigned.pem --format Pem -np | |
| public static X509Certificate2 GetCertificate() | |
| { | |
| X509Certificate2 sslCert = CreateFromPublicPrivateKey("certs/selfsigned.pem", "certs/selfsigned.key"); | |
This file contains hidden or 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
| package main | |
| import ( | |
| "encoding/json" | |
| "fmt" | |
| "io/ioutil" | |
| "log" | |
| "net/http" | |
| ) |
This file contains hidden or 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
| $yarnPath = & yarn global bin | |
| $path = [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User) | |
| [System.Environment]::SetEnvironmentVariable("PATH", "$path;$yarnPath", [System.EnvironmentVariableTarget]::User) | |
| # Your yarn path should appear at the end of the path now | |
| [System.Environment]::GetEnvironmentVariable("PATH", [System.EnvironmentVariableTarget]::User) | |
| # Try a global command, for example gatsby. If you're using Visual Studio Code, you'll need to restart the IDE | |
| gatsby |
This file contains hidden or 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
| using System; | |
| using System.IO; | |
| using System.Security.Cryptography; | |
| using System.Security.Cryptography.X509Certificates; | |
| namespace PublicKeyCryptographyExample | |
| { | |
| // | |
| // https://yetanotherchris.dev/security/public-private-key-in-netcore-by-example/ | |
| // |
This file contains hidden or 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
| wget "http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en" | Select-Object -Expand Content | ConvertFrom-Json | Select-Object quoteText, quoteAuthor |