Skip to content

Instantly share code, notes, and snippets.

View jbasinger's full-sized avatar
🔮
One sec

Justin Basinger jbasinger

🔮
One sec
View GitHub Profile
@jbasinger
jbasinger / solution.cs
Last active March 14, 2021 00:48
LeetCode Problem 5
public string LongestPalindrome(string s)
{
if (s.Length == 0 || s.Length==1)
return s;
var longestPali = s[0].ToString();
for (var i = 0; i < s.Length; i++)
{
//Walk backward until you find the same character then start looking for a palindrome
@jbasinger
jbasinger / solution.cs
Last active March 13, 2021 01:34
Leetcode Problem 3
public int LengthOfLongestSubstring(string s)
{
if(s.Length == 0)
return 0;
if (s.Length == 1)
return 1;
var maxLength = 1;
var curLength = 0;
@jbasinger
jbasinger / AllALessThanB.cs
Last active March 12, 2021 22:05
Leetcode Problem 4
/*
* A [--|--]
* B [--|--]
*/
[Test]
public void AllOfAIsLessThanB()
{
var nums1 = new int[]{1,2,3,4};
var nums2 = new int[]{10,11,12,13,14};
var appended = new int[] {1, 2, 3, 4, 10, 11, 12, 13, 14};
FROM public.ecr.aws/lambda/dotnet:5.0
#You can alternately also pull these images from DockerHub amazon/aws-lambda-dotnet:5.0
# Copy function code
COPY net5-lambda-template/bin/Debug/net5.0 ${LAMBDA_TASK_ROOT}
# Set the CMD to your handler (could also be done as a parameter override outside of the Dockerfile)
CMD [ "net5-lambda-template::net5_lambda_template.LambdaFunction::Handler" ]
public class ListNode
{
public int val;
public ListNode next;
public ListNode(int val = 0, ListNode next = null)
{
this.val = val;
this.next = next;
}
@jbasinger
jbasinger / twosum.cs
Created January 27, 2021 01:28
Leet Code Problem 1 Two Sum
namespace LeetCode
{
public class TwoSum_Problem
{
public static int[] TwoSum(int[] nums, int target)
{
for (int i = 0; i < nums.Length; i++)
{
for (int j = i+1; j < nums.Length; j++)
{
@jbasinger
jbasinger / CodeSnippet.razor
Last active January 2, 2021 18:02
Blazor Code Snippet Components
<pre class="code"><code class="@Language">
@ChildContent
</code></pre>
@code {
[Inject] private IJSRuntime _js { get; set; }
[Parameter] public RenderFragment ChildContent { get; set; }
[Parameter] public string Language { get; set; } = "csharp";
@jbasinger
jbasinger / buildspec.yml
Last active November 29, 2020 17:22
Updated codebuild policy to allow access to cloudfront invalidations
version: 0.2
phases:
build:
commands:
- set -e
- docker-compose up -d site
- docker cp serverless-blazor:/app/ServerlessBlazor/build/wwwroot .
- docker-compose down
- aws s3 sync ./wwwroot s3://<YOUR S3 BUCKET NAME>
version: 0.2
phases:
build:
commands:
- set -e
- mkdir ./build
- cp ./public/** ./build
- aws s3 sync ./build s3://simple-cloud-formation
@jbasinger
jbasinger / Dockerfile
Last active September 21, 2020 16:34
An easy docker-compose that sets up an MSSQL server container with shared backup and scripts folders and a couple scripts to restore backups
FROM ubuntu:latest
ENV TERM xterm-256color
WORKDIR /root
RUN apt-get update \
&& apt-get install -y \
ripgrep \
jq \
zsh \
curl \
git