Skip to content

Instantly share code, notes, and snippets.

View gtechsltn's full-sized avatar
🍊

Nguyen Viet Manh gtechsltn

🍊
View GitHub Profile
@gtechsltn
gtechsltn / Dapper Scalar Query.cs
Created May 7, 2024 02:34 — forked from brazilnut2000/Dapper Scalar Query.cs
Dapper: Execute Scalar query
int value = conn.Query<int>(sql, args).Single();
string value = conn.Query<string>(sql, args).Single();
http://stackoverflow.com/questions/8050636/is-there-an-executescalar-in-dapper
using System;
using System.Collections.Generic;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Reflection;
using System.Configuration.Install;
namespace test
{
using System;
using System.Threading;
class Program
{
static void Main()
{
AutoResetEvent reset = new AutoResetEvent(false);
StatusChecker status = new StatusChecker(5);
@gtechsltn
gtechsltn / GenerateOpenApiOnBuildFromNet8MinimalApi.md
Created March 30, 2024 17:49 — forked from VincentH-Net/GenerateOpenApiOnBuildFromNet8MinimalApi.md
Generate OpenApi.json on build from ASP.NET 8 Minimal API

To generate OpenApi.json on build from an ASP.NET 8 Minimal API, follow these steps:

  1. In Visual Studio for Windows 17.7.0 or later, create a new ASP.NET Core API project

  2. Follow these instructions to install Swashbuckle.AspNetCore.Cli as a local dotnet tool in your project

  3. Add these NuGet packages (or later versions) to the project:

  <ItemGroup>
  	<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.0-preview.4.23260.4" />
@gtechsltn
gtechsltn / pyclean.sh
Created January 29, 2024 04:34 — forked from technocake/pyclean.sh
Clear all python cache in directory
# pyclean command to clear all python cache in a directory
# source: https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files
# in .bash_profile / .bash_rc etc put:
pyclean () {
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete
}
@gtechsltn
gtechsltn / README.md
Created January 21, 2024 14:58 — forked from Robert-96/README.md
Ember.Js: Installing Tailwind CSS

Ember.Js: Installing Tailwind CSS

TL;DR

$ ember install ember-cli-postcss                   # Install ember-cli-postcss
$ npm install --save-dev tailwindcss                # Install tailwindcss

$ npx tailwind init app/styles/tailwind.config.js   # Optional: Generate a Tailwind config file for your project  
$ npm install -save-dev postcss-import # Optional: If you want to use the @import statement
@gtechsltn
gtechsltn / debug_ember_app_in_vscode.md
Created January 21, 2024 09:04 — forked from nightire/debug_ember_app_in_vscode.md
How to debug an ember application with VS Code

Step 1: Launch Google Chrome with Remote Debugging support

  • windows: <path to chrome>/chrome.exe --remote-debugging-port=9222
  • macOS: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222
  • linux: google-chrome --remote-debugging-port=9222

Step 2: Install "Debugger for Chrome" extension

Step 3: Setup your application

@gtechsltn
gtechsltn / AppCmdWrapper.ps1
Created January 12, 2024 04:50 — forked from adamcarr1976/AppCmdWrapper.ps1
A very basic powershell wrapper for appcmd.exe
$appCmdPath = "$env:SystemRoot\system32\inetsrv\appcmd.exe"
$webApplicationName = "Amc76.Web";
$iteration = "0.1"
$applicationPoolName = $webApplicationName + $iteration;
function Test-ApplicationPool([string]$appPoolName)
{
$appPool = . $appCmdPath list apppools $appPoolName
return $appPool -ne $null
}
@gtechsltn
gtechsltn / Sample.cs
Created January 2, 2024 23:20 — forked from ankitkanojia/Sample.cs
Upload/Save media file using HttpPostedFileBase class in C# MVC
using ProjectNameSpace.Helpers;
using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
namespace ProjectNameSpace.Controllers
@gtechsltn
gtechsltn / gist:3ebb66326fcce3c12166cb62c841ec61
Created December 28, 2023 16:53 — forked from dinhducit/gist:c738077089853f34d08d64f491ba5d89
Implement Active Directory Authentication in ASP.NET MVC 5
//pulled from site: http://www.schiffhauer.com/mvc-5-and-active-directory-authentication/
using System.Web.Mvc;
using System.Web.Security;
using MvcApplication.Models;
public class AccountController : Controller
{
public ActionResult Login()