Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
yuhonas committed Feb 11, 2024
1 parent 887c6a1 commit 43a6576
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 62 deletions.
12 changes: 9 additions & 3 deletions pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ export default function Home() {
</Link>
<p className="text-xs">Regular PDF</p>
<h4 className="text-2xl font-bold mt-12 mb-4">Something to geek out on</h4>
<p className="mb-4 ">
This site and the following files are generated from <a href="https://jsoncrack.com/editor?json=https://raw.githubusercontent.com/yuhonas/clintp.xyz/main/resume/resume.clintp.json" className="underline">resume.clintp.json</a> which conforms to <a href="https://jsonresume.org/" target="_blank" className="underline">JSON Resume</a></p>

<ul className="mb-4 list-disc">
<li>My resume is stored in <a href="https://jsonresume.org/" className="underline">JSON Schema</a> format, it can be viewed at <a href="https://raw.githubusercontent.com/yuhonas/clintp.xyz/main/resume/resume.clintp.json" className="underline">resume.clintp.json</a></li>
<li>The resume is automagically linted/spell checked and built into various formats</li>
<li>You can explore the data using tools like <a href="https://jsoncrack.com/editor?json=https://raw.githubusercontent.com/yuhonas/clintp.xyz/main/resume/resume.clintp.json" className="underline">JSON Crack</a> or
&nbsp;<a href="https://lite.datasette.io/?json=https://raw.githubusercontent.com/yuhonas/clintp.xyz/main/resume/resume.clintp.json#/data/resume?_sort=rowid&_facet=name&_facet=location" className="underline">lite.datasette.io</a>
</li>
<li>As part of the <a href="https://github.com/yuhonas/clintp.xyz/blob/main/.github/workflows/ci.yml" className="underline">resume build</a>, a gist is updated which enables the resume to be published on <a href="https://registry.jsonresume.org/yuhonas" className="underline">registry.jsonresume.com</a>, see also <a href="https://registry.jsonresume.org/yuhonas?theme=stackoverflow" className="underline">here</a> for an example of the resume rethemed </li>
</ul>
<p className="mb-4">This following files are also available</p>
<ul className="mb-4 flex gap-3">
{/* <li>
<Link href="https://jsoncrack.com/editor?json=https://raw.githubusercontent.com/yuhonas/clintp.xyz/main/resume/resume.clintp.json" className="hover:underline">
Expand Down
Binary file added resume/build/clintp-qrcode.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resume/build/clintp.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file removed resume/examples/__init__.py
Empty file.
67 changes: 8 additions & 59 deletions resume/examples/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def output(self):
return luigi.LocalTarget(self.output_file)


class ConvertProfileImage(luigi.Task):
class FetchAndConvertProfileImage(luigi.Task):
def requires(self):
return {
'resume': ExtractResume()
Expand All @@ -26,27 +26,21 @@ def run(self):
resume = json.load(open(self.input()['resume'].path))
profile_image = urlopen(resume['basics']['image'])

with open('clintp.jpg', 'wb') as f:
f.write(profile_image.read())

image = Image.open('clintp.jpg').quantize(
image = Image.open(profile_image).quantize(
colors=256, method=2).convert('RGB')

image_tiny = image.resize((40, 40))
# resizing the smaller image to the original size
pixelated = image_tiny.resize(image.size, Image.NEAREST)
pixelated = image.resize((40, 40)).resize(image.size, Image.NEAREST)

pixelated.save(self.output().path)

def output(self):
return luigi.LocalTarget("clintp.gif")
return luigi.LocalTarget("build/clintp.gif")


class TaskA(luigi.Task):
class GenerateQrCode(luigi.Task):
def requires(self):
return {
'resume': ExtractResume(),
'profile_image': ConvertProfileImage()
'profile_image': FetchAndConvertProfileImage()
}

def run(self):
Expand All @@ -66,54 +60,9 @@ def run(self):
target=self.output().path, scale=5)

def output(self):
return luigi.LocalTarget("clintp-qrcode.gif")


class TaskB(luigi.Task):
def requires(self):
return TaskA()

def run(self):
# TaskB logic here
vcard_data = open(self.input().path).read()

qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=4,
)
qr.add_data(vcard_data)
qr.make(fit=True)

img = qr.make_image(fill_color="#61418E", back_color="transparent")

img.save(self.output().path)

print("TaskB completed")

def output(self):
return luigi.LocalTarget("clintp.png")


# class TaskC(luigi.Task):
# def requires(self):
# return TaskA()

# def run(self):
# # TaskC logic here
# print("TaskC completed")


# class TaskD(luigi.Task):
# def requires(self):
# return [TaskB(), TaskC()]

# def run(self):
# # TaskD logic here
# print("TaskD completed")
return luigi.LocalTarget("build/clintp-qrcode.gif")


if __name__ == "__main__":
# luigi.build([TaskD()], workers=1, local_scheduler=True)
luigi.build([TaskA()], workers=1, local_scheduler=True)
luigi.build([GenerateQrCode()], workers=1, local_scheduler=True)

0 comments on commit 43a6576

Please sign in to comment.