nssm.exe install SERVICE_NAME "C:\path\to\exe\or\bat\file.ext" "argument1 argument2"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| git config core.editor "'C:\Program Files (x86)\Notepad++\notepad++.exe' -multiInst -notabbar -nosession -noPlugin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Unzip($zipfile, $outdir) | |
| { | |
| Add-Type -AssemblyName System.IO.Compression.FileSystem | |
| $archive = [System.IO.Compression.ZipFile]::OpenRead($zipfile) | |
| foreach ($entry in $archive.Entries) | |
| { | |
| $entryTargetFilePath = [System.IO.Path]::Combine($outdir, $entry.FullName) | |
| $entryDir = [System.IO.Path]::GetDirectoryName($entryTargetFilePath) | |
| #Ensure the directory of the archive entry exists |
<!- .... ->
<log4net>
<appender name="RollingLogFileAppenderLogstash" type="log4net.Appender.RollingFileAppender">
<encoding value="utf-8" />
<!--该目录必需有 IIS用户 写权限-->
<file value="X:/var/log/[app_name]/logfile.log" />
<appendToFile value="true" />
<rollingStyle value="Date" />
<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Retry http with a back off on failure | |
| await Policy.Handle<HttpRequestException>().WaitAndRetryAsync(3, retryAttempt => TimeSpan.FromSeconds(Math.Pow(2, retryAttempt))) | |
| .ExecuteAsync(async () => | |
| { | |
| var result = await httpClient.GetAsync("api/CallToServer/" + varibleToSendToServer, cancellationToken); | |
| if (result.IsSuccessStatusCode) | |
| { | |
| returnValue = await result.Content.ReadAsAsync<List<Results>>(token); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Props to qmx and abstractj for the inspiration | |
| # | |
| # Put this file in your home directory and these lines to .profile | |
| # if [[ -f "$HOME/.java.env" ]]; then | |
| # source "$HOME/.java.env"; | |
| # fi | |
| VERSION=$1 | |
| if [ ! -n "$VERSION" ] |
Microsoft’s navigator.msLaunchUri method only works in Internet Explorer on Windows 8. Therefore I came up with a (nearly) cross-browser implementation that uses the native msLaunchUri when it’s available and falls back to adventurous hacks when running in other browsers.
launchUri (uri, successCallback, noHandlerCallback, unknownCallback)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.IO; | |
| using System.Threading; | |
| using System.Threading.Tasks; | |
| using Serilog; | |
| using Serilog.Extras.Topshelf; | |
| using Topshelf; | |
| using Topshelf.Logging; | |
| namespace ConsoleApplication1 | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using Autofac; | |
| using FluentValidation; | |
| namespace Sample.Web.Infrastructure | |
| { | |
| public class AutofacValidatorFactory : ValidatorFactoryBase | |
| { | |
| private readonly IComponentContext _context; |