This file contains 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
name: CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v1 |
This file contains 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
\a an ASCII bell character (07) | |
\d the date in "Weekday Month Date" format (e.g., "Tue May 26") | |
\e an ASCII escape character (033) | |
\h the hostname up to the first '.' | |
\H the hostname | |
\j the number of jobs currently managed by the shell | |
\l the basename of the shell's terminal device name | |
\n newline | |
\r carriage return | |
\s the name of the shell, the basename of $0 (the portion following the final slash) |
This file contains 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
public void ConfigureServices(IServiceCollection services) | |
{ | |
var jwtTokenConfig = Configuration.GetSection("jwtTokenConfig").Get<JwtTokenConfig>(); | |
services.AddSingleton(jwtTokenConfig); | |
services.AddAuthentication(x => | |
{ | |
x.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme; | |
x.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme; | |
}).AddJwtBearer(x => | |
{ |
This file contains 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
public class BasicAuthFilter : IAuthorizationFilter | |
{ | |
private readonly string _realm; | |
public BasicAuthFilter(string realm) | |
{ | |
_realm = realm; | |
if (string.IsNullOrWhiteSpace(_realm)) | |
{ | |
throw new ArgumentNullException(nameof(realm), @"Please provide a non-empty realm value."); |
This file contains 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
public abstract class CronJobService : IHostedService, IDisposable | |
{ | |
private System.Timers.Timer _timer; | |
private readonly CronExpression _expression; | |
private readonly TimeZoneInfo _timeZoneInfo; | |
protected CronJobService(string cronExpression, TimeZoneInfo timeZoneInfo) | |
{ | |
_expression = CronExpression.Parse(cronExpression); | |
_timeZoneInfo = timeZoneInfo; |
This file contains 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
public string GetAccountNumber() | |
{ | |
static bool IsRecruit(string purposeCode) => new List<string> { "AR", "SR", "FR" }.Contains(purposeCode); | |
return (GroupTravel, TravelerType, Destination) switch | |
{ | |
(true, _, "I") => "6034", | |
(true, _, "O") => "6035", | |
(true, _, "F") => "6036", | |
(false, TravelerType.FacultyStaff, "I") => "6025", | |
(false, TravelerType.FacultyStaff, "O") => "6026", |
This file contains 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
version: '3.8' | |
services: | |
rabbitmq: | |
image: rabbitmq:3-management | |
hostname: my-rabbit | |
volumes: | |
- ./rabbitmq/etc/definitions.json:/etc/rabbitmq/definitions.json | |
- ./rabbitmq/etc/rabbitmq.conf:/etc/rabbitmq/rabbitmq.conf | |
- ./rabbitmq/data:/var/lib/rabbitmq/mnesia/rabbit@my-rabbit |
This file contains 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
public async Task<string> UploadFile(string filePath) | |
{ | |
_logger.LogInformation($"Uploading a text file [{filePath}]."); | |
if (string.IsNullOrWhiteSpace(filePath)) | |
{ | |
throw new ArgumentNullException(nameof(filePath)); | |
} | |
if (!File.Exists(filePath)) | |
{ |
This file contains 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
export function appInitializer(authService: AuthService) { | |
return () => | |
new Promise((resolve) => { | |
console.log('refresh token on app start up') | |
authService.refreshToken().subscribe().add(resolve); | |
}); | |
} |
This file contains 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
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)] | |
public class BasicAuthAttribute : TypeFilterAttribute | |
{ | |
public BasicAuthAttribute(string realm = @"My Realm") : base(typeof(BasicAuthFilter)) | |
{ | |
Arguments = new object[] { realm }; | |
} | |
} |
NewerOlder