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
def decodeDynamo(path): | |
allItems = [] | |
with gzip.open(path, 'rb') as f: | |
for line in f: | |
try: | |
line_str = line.decode('utf-8').strip() | |
item_data = json.loads(line_str)['Item']['data']['S'] | |
allItems.append(json.loads(item_data)) | |
except json.JSONDecodeError as e: # Change this to the specific exceptions you expect | |
print(f"Error parsing line: {e}") |
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: deploy | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build: | |
name: build |
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
import SwiftUI | |
import PDFKit | |
struct PhotoDetailView: UIViewRepresentable { | |
let image: UIImage | |
func makeUIView(context: Context) -> PDFView { | |
let view = PDFView() | |
view.document = PDFDocument() | |
guard let page = PDFPage(image: image) else { return view } |
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
import Foundation | |
import CryptoKit | |
extension String { | |
private func hash<H: HashFunction>(with closure: () -> H) -> String { | |
let inputData = Data(self.utf8) | |
let hash = H.hash(data: inputData) | |
let hashString = hash.compactMap { String(format: "%02hhx", $0) }.joined() | |
return hashString |
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
import boto3 | |
import itertools | |
# Initialize the boto3 client for AWS Lambda | |
lambda_client = boto3.client('lambda', region_name='ap-southeast-1') | |
# Get the list of all lambda functions | |
paginator = lambda_client.get_paginator('list_functions') | |
# response = lambda_client.list_functions(MaxItems=10000) |
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
from enum import Enum | |
class Foo(Enum): | |
A = 1 | |
B = 2 | |
C = 3 | |
def __str__(self): | |
return self.name |
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
def solve(grid): | |
empty_cell = find_empty_cell(grid) | |
if not empty_cell: | |
return grid | |
row, col = empty_cell | |
possible_numbers = get_possible_numbers(grid, row, col) | |
for num in possible_numbers: | |
grid[row][col] = num | |
solved_grid = solve(grid) |
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
AWSTemplateFormatVersion: '2010-09-09' | |
Transform: AWS::Serverless-2016-10-31 | |
Resources: | |
WarmFunction: | |
Type: AWS::Serverless::Function | |
Properties: | |
CodeUri: ./src | |
Handler: index.handler | |
Runtime: python3.8 | |
Events: |
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
Resources: | |
HelloWorldAPI: | |
Type: AWS::Serverless::Api | |
Properties: | |
Name: Hello World API | |
StageName: Prod | |
HelloWorldFunction: | |
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction | |
Properties: | |
PackageType: Image |
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 href="#" style=" | |
text-decoration: none; | |
font-family: helvetica; | |
font-weight: bold; | |
color: #ddd; | |
background-color: black; | |
height: 30px; | |
display: inline-block; | |
padding: 1px 12px 0 0; | |
border-radius: 5px; |
NewerOlder