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
# 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 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 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 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 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 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 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 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 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 |
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
// Add the following nuget package for Base64Url decoding: | |
// dotnet add package Microsoft.AspNetCore.WebUtilities | |
// This example JWT is taken from jwt.io | |
string jwt = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c"; | |
string[] parts = jwt.Split('.'); | |
foreach (string section in parts) | |
{ | |
// The final (3rd) section is the JWT signature, so will appear as nonsense as it isn't JSON |
NewerOlder