Instantly share code, notes, and snippets.

View Program.cs
private static void GetMixedContent(string[] urls)
{
// generate log file and header
WriteHeader();
// chrome option
var options = new ChromeOptions();
options.AddArgument("--headless");
options.AddArgument("--no-sandbox");
View Dockerfile
FROM microsoft/dotnet:2.2-sdk-bionic AS build
WORKDIR /app
# restore
COPY src/MixedContentChecker/*.csproj ./MixedContentChecker/
WORKDIR /app/MixedContentChecker
RUN dotnet restore
# build
WORKDIR /app
View Get-MixedContent.ps1
#!/usr/bin/env pwsh
#Requires -Version 6.0
param(
[string]$Url = "$env:SITE_MAP_URL"
)
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
if ( -not (Test-Path -LiteralPath './WebDriver.dll')) {
Write-Error 'missing WebDriver.dll'
return
View Dockerfile
FROM mcr.microsoft.com/powershell:ubuntu-xenial
WORKDIR /app
RUN apt-get update \
&& apt-get install -y wget unzip
RUN apt install -y gdebi \
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \
&& gdebi -n google-chrome-stable_current_amd64.deb \
&& rm google-chrome-stable_current_amd64.deb
RUN wget https://chromedriver.storage.googleapis.com/2.45/chromedriver_linux64.zip \
&& unzip chromedriver_linux64.zip \
View Teamsid2BitwardenConverter.cs
void Main()
{
var outputPath = $@"./bitwarden_import/bitwarden_importdata{DateTime.Now.ToString("yyyyMMdd_HHmmss")}.json";
var teamsidPersonalCsv = @"./teamsid_export/indivisual_records_2019-01-12 20_08_36.csv";
var teamsidOrganizationCsv = @"./teamsid_export/Organization_records_2019-01-12 21_20_10.csv";
var teamsidCsvs = new[] { teamsidPersonalCsv, teamsidOrganizationCsv };
var bitwardenFolderDefinitionJson = @"./bitwarden_export/bitwarden_export_folder_definition.json";
// deserialize folder definitions
BitwardenFolderDefinition DeserializeFolderJson(string path)
View main.go
package main
import (
"fmt"
"os"
sitemap "github.com/yterajima/go-sitemap"
)
func main() {
View main.go
package main
import (
"encoding/xml"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
)
View Program.cs
using System;
using System.Linq;
using System.Net.Http;
using System.Threading.Tasks;
using System.Xml.Linq;
namespace Hatenablog_Sitemap
{
class Program
{
View Get-SitemapUrl.ps1
#Requires -Version 6.0
Set-StrictMode -Version Latest
function Get-SitemapUrl {
[OutputType([string[]])]
param(
[Parameter(Mandatory = $true)]
[string]$Url
)
$res = Invoke-Webrequest "$Url/sitemap.xml"
View .editorconfig
# EditorConfig is awesome: http://EditorConfig.org
# top-most EditorConfig file
root = true
# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf