Skip to content

Instantly share code, notes, and snippets.

View inspirit941's full-sized avatar

Donggeon Lee inspirit941

View GitHub Profile
#!/bin/python3
import math
import os
import random
import re
import sys
from collections import deque
#
# Complete the 'matrixRotation' function below.
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'hackerlandRadioTransmitters' function below.
from collections import deque
import sys
n = int(sys.stdin.readline())
maps =[]
dirs = [(-1,0),(1,0),(0,-1),(0,1)]
max_value = 0
for _ in range(n):
arr = list(map(int, sys.stdin.readline().split()))
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'almostSorted' function below.
#!/bin/python3
import math
import os
import random
import re
import sys
# Complete the flatlandSpaceStations function below.
def flatlandSpaceStations(n, c):
#!/bin/python3
import math
import os
import random
import re
import sys
#
# Complete the 'lilysHomework' function below.
// ServeHTTP implements http.Handler.
func (h *Router) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Path-based dispatch
h.routersMu.RLock()
keyedHandler, ok := h.routers[r.URL.Path]
h.routersMu.RUnlock()
if ok {
// Check if source still exists.
_, err := h.lister.GitHubSources(keyedHandler.namespace).Get(keyedHandler.name)
func (r *Reconciler) FinalizeKind(ctx context.Context, source *sourcesv1alpha1.GitHubSource) pkgreconciler.Event {
// If a webhook was created, try to delete it
if source.Status.WebhookIDKey != "" {
// Get access token
accessToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.AccessToken.SecretKeyRef)
if apierrors.IsNotFound(err) {
source.Status.MarkNoSecrets("AccessTokenNotFound", "%s", err)
controller.GetEventRecorder(ctx).Eventf(source, corev1.EventTypeWarning,
"WebhookDeletionSkipped", "Could not delete webhook %q: %v", source.Status.WebhookIDKey, err)
// return EventTypeNormal to avoid finalize loop
func (r *Reconciler) ReconcileKind(ctx context.Context, source *sourcesv1alpha1.GitHubSource) pkgreconciler.Event {
source.Status.InitializeConditions()
accessToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.AccessToken.SecretKeyRef)
if err != nil {
source.Status.MarkNoSecrets("AccessTokenNotFound", "%s", err)
return err
}
secretToken, err := r.secretFrom(ctx, source.Namespace, source.Spec.SecretToken.SecretKeyRef)
if err != nil {