Skip to content

Instantly share code, notes, and snippets.

@tpugh
tpugh / Dockerfile
Last active July 3, 2020 16:08
Steps Towards Getting Things Done with GitHub Actions
FROM debian:9.5-slim
ADD entrypoint.sh /entrypoint.sh
RUN ["chmod", "+x", "/entrypoint.sh"]
ENTRYPOINT ["/entrypoint.sh"]
@tpugh
tpugh / entrypoint.sh
Created July 3, 2020 16:09
entrypoint
#!/bin/sh -l
sh -c "echo Hello world my name is $INPUT_MY_NAME"
name: "Hello Actions"
description: "Greet someone"
author: "octocat@github.com"
inputs:
@tpugh
tpugh / main.yml
Last active July 3, 2020 16:27
workflow file
name: A workflow for my Hello World file
on: push
jobs:
build:
name: Hello world action
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: ./action-a
with:
# Add 'label1' to any changes within 'example' folder or any subfolders
label1:
- example/**/*
# Add 'label2' to any file changes within 'example2' folder
label2: example2/*
@tpugh
tpugh / labeler.yml
Created July 3, 2020 19:24
workflow/labeler
name: "Pull Request Labeler"
on:
- pull_request
jobs:
triage:
runs-on: ubuntu-latest
steps:
- uses: actions/labeler@v2
with:
# Python program to illustrate string
def uniqueCharacters(str):
# If at any time we have samme
# characters, return false
for i in range(len(str)):
for j in range(i + 1,len(str)):
if(str[i] == str[j]):
class Node:
def __init__(self, data):
self.data = data
self.next = None
class LinkedList:
def __init__(self):
# Python3 program to reverse a queue
from queue import Queue
# Utility function to print the queue
def Print(queue):
while (not queue.empty()):
print(queue.queue[0], end = ", ")
queue.get()
# Function to reverse the queue
@tpugh
tpugh / gist:52ffd77e31324463408cd159983556bf
Last active July 5, 2021 13:45
Given a string, find the length of the longest substring without repeating characters.
class Solution:
def lengthOfLongestSubstring(self, s: str) -> int:
n = len(s)
ans = 0
# mp stores the current index of a character
mp = {}
i = 0
# try to extend the range [i, j]
for j in range(n):