Skip to content

Instantly share code, notes, and snippets.

@foreach (var item in new string[] { "AspNetCore","AspNet","SomeJsThingWhatever"})
{
<div>
<input type="radio" name="technology" id="@item" value="@item" @onchange="RadioSelection" checked=@(RadioValue.Equals(item,StringComparison.OrdinalIgnoreCase)) />
<label for="@item">@item</label>
</div>
}
<div>
<label>Selected Value is @RadioValue</label>
</div>
@donhuvy
donhuvy / curl.md
Created September 6, 2021 15:04 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@donhuvy
donhuvy / setup.sql
Created September 22, 2021 07:17 — forked from robdmoore/setup.sql
Automated install of SQL Express from commandline
# If you want to give owner access to the whole server to a particular user account this is how
exec sp_addrolemember 'db_owner', 'NT AUTHORITY\NETWORK SERVICE';
GO
# If you want to idempotently ensure a particular database with name DatabaseName exists this is how
IF NOT db_id('DatabaseName') IS NOT NULL BEGIN
PRINT 'Creating database...'
CREATE DATABASE [DatabaseName]
PRINT 'Created database.'
@donhuvy
donhuvy / devcamper_specs.md
Created December 11, 2021 15:34 — forked from bradtraversy/devcamper_specs.md
Specs for Devcamper Udemy course project

DevCamper Backend API Specifications

Create the backend for a bootcamp directory website. The frontend/UI will be created by another team (future course). The html/css template has been created and can be used as a reference for functionality. All of the functionality below needs to be fully implmented in this project.

Bootcamps

  • List all bootcamps in the database
    • Pagination
    • Select specific fields in result
    • Limit number of results
  • Filter by fields
@donhuvy
donhuvy / ner_dataset.csv
Created July 14, 2022 15:10 — forked from famasya/ner_dataset.csv
ner_dataset.csv
We can't make this file beautiful and searchable because it's too large.
Sentence #,Word,POS,Tag
Sentence: 1,Thousands,NNS,O
,of,IN,O
,demonstrators,NNS,O
,have,VBP,O
,marched,VBN,O
,through,IN,O
,London,NNP,B-geo
,to,TO,O
,protest,VB,O
# TQDM: Python progress bar tutorial
# Youtube Video: https://www.youtube.com/watch?v=n4E7of9BINo
import pandas as pd
import numpy as np
from time import sleep
from tqdm import tqdm, trange
# Create Fake Data
dogs = np.random.choice(['labradoodle','beagle','mutt'], size=50_000)

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@donhuvy
donhuvy / goGetPrivate.md
Created May 5, 2023 09:43 — forked from StevenACoffman/goGetPrivate.md
How to `go get` private repos using SSH key auth instead of password auth.

Set GOPRIVATE to match your github organization

Cloning the repo using one of the below techniques should correctly but you may still getting an unrecognized import error.

As it stands for Go v1.13, I found in the doc that we should use the GOPRIVATE variable like so:

GOPRIVATE=github.com/ORGANISATION_OR_USER_NAME go get -u -f github.com/ORGANISATION_OR_USER_NAME/REPO_NAME

The 'go env -w' command (see 'go help env') can be used to set these variables for future go command invocations.

How to go get private repos using SSH key auth instead of password auth.

wget -O /tmp/YaHei.Consolas.1.12.zip https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/uigroupcode/YaHei.Consolas.1.12.zip
unzip /tmp/YaHei.Consolas.1.12.zip
sudo mkdir -p /usr/share/fonts/consolas
sudo mv YaHei.Consolas.1.12.ttf /usr/share/fonts/consolas/
sudo chmod 644 /usr/share/fonts/consolas/YaHei.Consolas.1.12.ttf
cd /usr/share/fonts/consolas
sudo mkfontscale && sudo mkfontdir && sudo fc-cache -fv
@donhuvy
donhuvy / Application.properties
Created June 3, 2023 13:07 — forked from Akashpatel579/Application.properties
Reactive CRUD APIs with Spring WebFlux
logging.level.org.springframework=ERROR
#logging.level.org.springframework=TRACE
logging.level.com=TRACE
server.port=8080
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=testdb