Skip to content

Instantly share code, notes, and snippets.

package main
import (
//"crypto/ed25519"
"golang.org/x/crypto/ed25519"
"log"
"time"
"github.com/o1egl/paseto"
Add-Type -AssemblyName System.Net.Http
# proxy
$bypassOnLocal = $TRUE
$proxy = [System.Net.WebRequest]::GetSystemWebProxy()
#$proxy = New-Object System.Net.WebProxy("http://localhost:8888", $bypassOnLocal)
#$proxy.Credentials = [System.Net.CredentialCache].DefaultNetworkCredentials
#$proxy.Credentials = New-Object System.Net.NetworkCredential("username", "password")
$password = ConvertTo-SecureString "password" -asplaintext -force
$cred = New-Object System.Management.Automation.PsCredential "username",$password

Installing Golang on Windows10

Open PowerShell and execute the code below:

cd C:\data\tools
Remove-Item go.bk -Recurse
Rename-Item go go.bk
curl "https://golang.org/dl/go1.16.6.windows-amd64.zip" -o go.zip -L
Expand-Archive -Path go.zip -DestinationPath .
package main
import (
"context"
"flag"
"fmt"
"log"
"net"
"os"
"os/exec"
// copyright (c) 2010 yujp
package main
import (
"bytes"
"encoding/binary"
"encoding/json"
"flag"
"fmt"
"io"

Installing Portable Python on Windows10

Open PowerShell and execute the code below:

Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.9.6/python-3.9.6-embed-amd64.zip" -OutFile "python.zip"
Expand-Archive -Path python.zip -DestinationPath python
Remove-Item python.zip

cd python
#include <iostream>
#include <filesystem>
#include <regex>
int main(int argc,char *argv[]){
if (argc < 4) {
std::cout << "Usage: \"" << argv[0] << "\" <dir> <pattern> <template>" << std::endl;
return 0;
}
auto &dir = argv[1];
package main
import (
"bufio"
"fmt"
"io"
"io/ioutil"
"math"
"net/http"
"os"
package main
import (
"fmt"
"os"
"path/filepath"
"regexp"
"flag"
)
package main
import (
"bufio"
"os"
"strings"
"fmt"
"time"
"io"
)