Skip to content

Instantly share code, notes, and snippets.

@hoangitk
hoangitk / client_fetch.js
Last active May 12, 2020 07:53
[Replace axios with a simple custom fetch wrapper] #js #fetch
// https://kentcdodds.com/blog/replace-axios-with-a-simple-custom-fetch-wrapper
const localStorageKey = '__bookshelf_token__'
function client(endpoint, {body, ...customConfig} = {}) {
const token = window.localStorage.getItem(localStorageKey)
const headers = {'content-type': 'application/json'}
if (token) {
headers.Authorization = `Bearer ${token}`
}
const config = {
method: body ? 'POST' : 'GET',
@hoangitk
hoangitk / ssh_installation.md
Last active April 29, 2022 08:30
[SSH Installation] #ssh #openssh

SSH

Installation

  • Check version
> Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'
Name  : OpenSSH.Client~~~~0.0.1.0
State : Installed

Name  : OpenSSH.Server~~~~0.0.1.0
@hoangitk
hoangitk / git_cmd_multile_folders.ps1
Created April 16, 2020 16:35
[git cmd multiple folder] #git #powershell
# Credit: http://antonkallenberg.com/2017/12/02/execute-a-git-command-in-multiple-folders-using-powershell/
# Usage: PS > .\git-multi.ps1 -cmd "pull"
param (
# The root directory to perform the pull in
$baseDir = ".",
# How deep down you want to look for .git folders
$depth = 2,
@hoangitk
hoangitk / IIS_Verbs.config
Last active April 16, 2020 15:19 — forked from jalalhejazi/IIS_Verbs.config
CORS: Web.config to enable CORS
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*"/>
<add name="Access-Control-Allow-Methods" value="GET,PUT,POST,DELETE,OPTIONS"/>
<add name="Access-Control-Allow-Headers" value="Content-Type"/>
</customHeaders>
</httpProtocol>
@hoangitk
hoangitk / nuget_package_management.md
Last active August 20, 2021 05:53
[Nuget Package Management] #csharp #package

Nuget Package Management

Updating Assembly Redirects with NuGet

> Get-Project –All | Add-BindingRedirect

Command

  • Disable source
@hoangitk
hoangitk / powershell_webadministration.md
Last active November 11, 2024 03:10
[Powershell WebAdministration] #powershell #web #admin

Web Administration

Modules

Import-Module WebAdministration

Create new App Pools

new-item AppPools\DemoAppPool
@hoangitk
hoangitk / cmd_collection.md
Last active November 11, 2024 03:10
[Cmd Collection] #cmd #collection #network #admin

CMD Collection

Networks

  • netsh lan show interfaces
  • netsh wlan show interfaces
  • route print
  • Turn off firewall: > netsh advfirewall set allprofiles state off

MSI

  • msiexec /i c:\path\to\package.msi /quiet /qn /norestart
@hoangitk
hoangitk / powershell_collection.md
Last active November 23, 2023 03:50
[Powershell Collection] #powershell #collection
@hoangitk
hoangitk / paths_collection.md
Last active June 15, 2021 03:59
[Helpful Paths Collection] #path #collection

Common directories

  • %windir%\system32\inetsrv\config\applicationhost.config

  • C:\Program Files\IIS Express\AppServer\

  • C:\Windows\System32\OpenSSH\

  • %userprofile%.ssh

  • C:\ProgramData\ssh

@hoangitk
hoangitk / csharp_awesome.md
Created March 23, 2020 04:11
[C# Awesome] A collection of awesome #dotnetcore #libraries, #tools, #frameworks and software