<h1>Add Linux Swap Partition</h1>

Steps to add Swap Partition in Linux

Pre-requirements

Please use fdisk -l to get the target drive you want to use as the Swap space. Note: format the disk will lose all your data, Please back up before proceeding.

1. Format Disk into Linux swap / Solaris

$ fdisk /dev/sdb

Command (m for help): n
Command action: p
Partition number: 1
First cylinder: 
Last cylinder:

Note: Empty means use default value

command (m for help): t
Hex code: 82

command (m for help): w

2. Enable swap

$ mkswap -L swap1 /dev/sdb1

Modify /etc/fstab to add the line below

/dev/sdb1  swap  swap  defaults  0  0

3. Check Swap Space

$ swapon -a
$ swapon -s

<h1>Create Linux Swapfile</h1>

Create additional space use like “RAM”

1. Add Swap File

$ sudo fallocate -l 1G /swapfile

Create a 1GB swap file on Linux system

2. Set Swap File Permission

$ sudo chmod 600 /swapfile

3. Setup Linux Swap Area

$ sudo mkswap /swapfile

4. Enable the Swap

$ sudo swapon /swapfile

Modify /etc/fstab to enable the entry. Append the following line in the file

/swapfile swap swap defaults 0 0

5. Verify the swap status

$ sudo swapon --show

<h1>Bitcoin RPC Lib for .Net</h1>

Currently working on a Bitcoin RPC .Net Wrapper. The project can be found at
https://git.zh-code.com/zhironghuang/Bitcoin.RPC.Client

Nuget

https://www.nuget.org/packages/Bitcoin.RPC.Wrapper/1.0.0

Currently working on a Bitcoin RPC .Net Wrapper. The project can be found at
https://git.zh-code.com/zhironghuang/Bitcoin.RPC.Client

All functions implemented are based on official RPC reference that you can find at
https://bitcoin.org/en/developer-reference#rpc-quick-reference. Some API calls are deprecated but the reason why I keep those deprecated APIs is purely because there might be someone who needs it.

Any questions about the project can be posted here as comment and I will respond later.

<h1>Nuget QueryStringBuilder</h1>

A simple tool to help you build query string in html

A simple tool to help you build query string in html

Please take a look at Nuget page
https://www.nuget.org/packages/QueryStringBuilder/#

Usage

var qsb = new QueryStringBuilder();
qsb.Add("name", "value");
qsb.Add("name1", "value1");
qsb.Build(); // returns "?name=value&name1=value1"

Available Functions

void Add(string key, object value);
bool TryAdd(string key, object value);
string Get(string key);
bool Exist(string key);
void Remove(string key);
int Count();
string Build();

Install from Package Manager

Install-Package QueryStringBuilder -Version 1.0.2

<h1>Create new Local Dev Certificate + IIS Configuration</h1>

Run PowerShell in Administrator Mode
New-SelfSignedCertificate -DnsName “localhost” -CertStoreLocation cert:\LocalMachine\My

Run PowerShell in Administrator Mode

New-SelfSignedCertificate -DnsName "localhost" -CertStoreLocation cert:\LocalMachine\My

The line of code will automatically generate a certificate in the cert manager under personal.
You can access cert manager using “Run” -> “certmgr.msc”

Add certificate to Trusted CA

Right click the certificate in certmgr and export it to somewhere you can find in “.cer”

Once exported, double click the exported “.cer” and install the certificate in “LocalMachine”.

Configure for IIS

Change website binding type in IIS to “https” and select newly created certificate.

Configure Chrome to accept invalid localhost Certificates

Go to
chrome://flags/#allow-insecure-localhost

Enable the “Allow invalid certificates for resources loaded from localhost” and relaunch chrome.

Done

<h1>.Net Core Dockerfile with Selenium Chrome Driver</h1>

Use .Net Core 2.2 as an example

Use .Net Core 2.2 as an example

FROM microsoft/dotnet:2.2-sdk

Use microsoft/dotnet:2.2-sdk as base image

WORKDIR /src

Set current working directory

COPY ["MainApp/MainApp.csproj", "MainApp/"]
RUN dotnet restore "MainApp/MainApp.csproj"

Copy “.csproj” file to “MainApp” folder and restore packages

COPY . .

Copy everything in current directory into container “/src” folder

RUN dotnet publish "MainApp/MainApp.csproj" -c Release -o /app

Publish application in Release mode and set output folder to “/app”

RUN apt-get update
RUN apt-get install -y unzip xvfb libxi6 libgconf-2-4
RUN curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
RUN echo "deb [arch=amd64]  http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google-chrome.list
RUN apt-get -y update
RUN apt-get -y install google-chrome-stable
RUN wget https://chromedriver.storage.googleapis.com/73.0.3683.68/chromedriver_linux64.zip
RUN unzip chromedriver_linux64.zip
RUN chmod +x chromedriver
Update container source and install required libraries.
Add google key and source into system source list and update.
Install google-chrome-stable library.
Download ChromeDriver from Google and unzip.
Grant execute permission to the file, which allows the application to run. Otherwise, you will see permission denied.
ENTRYPOINT ["dotnet", "/app/MainApp.dll"]

Add entry point to the application. Note: The current working directory will be “/src” when application running. So make sure the web driver is located in the “/src”