Skip to content

Instantly share code, notes, and snippets.

View FisherMS's full-sized avatar
💭
I may be slow to respond.

Fisher FisherMS

💭
I may be slow to respond.
View GitHub Profile
@FisherMS
FisherMS / powershell-web-server.ps1
Created February 14, 2023 09:19 — forked from 19WAS85/powershell-web-server.ps1
A simple web server built with powershell.
# This is a super **SIMPLE** example of how to create a very basic powershell webserver
# 2019-05-18 UPDATE — Created by me and and evalued by @jakobii and the comunity.
# Http Server
$http = [System.Net.HttpListener]::new()
# Hostname and port to listen on
$http.Prefixes.Add("http://localhost:8080/")
# Start the Http Server
@FisherMS
FisherMS / SwaggerConfig.cs
Created December 9, 2022 06:38 — forked from DanielLarsenNZ/SwaggerConfig.cs
SwaggerConfig.cs for OAuth2 in ASP.NET Web API to enable Swagger UI auth with Azure AD
/*
The MIT License (MIT)
Copyright (c) 2016 Daniel Larsen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
@FisherMS
FisherMS / Downloader Sample
Created March 11, 2022 07:41 — forked from ialex32x/Downloader Sample
C# simple http download sample
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net.Sockets;
using System.Net;
namespace ConsoleApplication1
{
@FisherMS
FisherMS / Deploy-AzureResourceGroup.ps1
Created September 17, 2021 05:03 — forked from DarqueWarrior/Deploy-AzureResourceGroup.ps1
Updated Deploy-AzureResourceGroup.ps1 to use Az PowerShell module
#Requires -Version 6.0
Param(
[string] [Parameter(Mandatory=$true)] $ResourceGroupLocation,
[string] $ResourceGroupName = 'AppServiceAndSql',
[switch] $UploadArtifacts,
[string] $StorageAccountName,
[string] $StorageContainerName = $ResourceGroupName.ToLowerInvariant() + '-stageartifacts',
[string] $TemplateFile = 'WebSiteSQLDatabase.json',
[string] $TemplateParametersFile = 'WebSiteSQLDatabase.parameters.json',
@FisherMS
FisherMS / AccountController.cs
Created June 17, 2018 15:59 — forked from hikalkan/AccountController.cs
Adding a new property to session
//Add new property to claims on login
private async Task SignInAsync(User user, ClaimsIdentity identity = null, bool rememberMe = false)
{
if (identity == null)
{
identity = await _userManager.CreateIdentityAsync(user, DefaultAuthenticationTypes.ApplicationCookie);
}
identity.AddClaim(new Claim("Application_UserEmail", user.EmailAddress)); //SETTING NEW PROPERTY
@FisherMS
FisherMS / git_toturial
Created February 7, 2018 03:41 — forked from guweigang/git_toturial
git命令大全
git init # 初始化本地git仓库(创建新仓库)
git config --global user.name "xxx" # 配置用户名
git config --global user.email "xxx@xxx.com" # 配置邮件
git config --global color.ui true # git status等命令自动着色
git config --global color.status auto
git config --global color.diff auto
git config --global color.branch auto
git config --global color.interactive auto
git config --global --unset http.proxy # remove proxy configuration on git
git clone git+ssh://git@192.168.53.168/VT.git # clone远程仓库
@FisherMS
FisherMS / README.md
Created April 27, 2017 09:42 — forked from chuangbo/README.md
Python dynamic DNSPod DNS Script

替换上你的Email,密码,域名ID,记录ID等参数,就可以运行了。 会在后台一直运行,每隔30秒检查一遍IP,如果修改了就更新IP。

获得domain_id可以用curl curl -k https://dnsapi.cn/Domain.List -d "login_email=xxx&login_password=xxx"

获得record_id类似 curl -k https://dnsapi.cn/Record.List -d "login_email=xxx&login_password=xxx&domain_id=xxx"

@FisherMS
FisherMS / gist:3689b22b0c4214026c8f38ea5cc3b58c
Created September 7, 2016 09:23
基于LRU算法的连接检测实现
/// <summary>
/// 基于LRU算法的连接检测
/// </summary>
public class LRUDetect:IDisposable
{
/// <summary>
/// 构建检测器
/// </summary>
/// <param name="timeout">超时时间以毫秒为单位</param>
@FisherMS
FisherMS / gist:c5ca01ed643b856647c18b9fbbca058f
Created September 7, 2016 09:19
很多时候都需要开一些线程队列来处理一些非常密集轻量的工作或对一些任务处理进行有效的限制,这个时候一般都会想到开启队列和线程来处理.下面分享一个无锁的队列作业调度器.
/// <summary>
/// 作业调度器
/// </summary>
public class Dispatch
{
/// <summary>
/// 构建作业调度器
/// </summary>
public Dispatch()
{