Skip to content

Commit

Permalink
chore: cleanup, add project
Browse files Browse the repository at this point in the history
  • Loading branch information
jktrn committed Jun 23, 2024
1 parent 7a70c34 commit 55b8b82
Show file tree
Hide file tree
Showing 55 changed files with 309 additions and 602 deletions.
3 changes: 0 additions & 3 deletions app/blog/[...slug]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { components } from '@/components/MDXComponents'
import PageTitle from '@/components/PageTitle'
import siteMetadata from '@/data/siteMetadata'
import PostBare from '@/layouts/PostBare'
import PostLayout from '@/layouts/PostLayout'
import PostSimple from '@/layouts/PostSimple'
import type { Authors, Blog } from 'contentlayer/generated'
import { allAuthors, allBlogs } from 'contentlayer/generated'
import 'css/prism.css'
Expand All @@ -17,7 +15,6 @@ import { ReportView } from './view'

const defaultLayout = 'PostLayout'
const layouts = {
PostSimple,
PostLayout,
PostBare,
}
Expand Down
19 changes: 8 additions & 11 deletions components/CodeBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { getLanguageIcon } from '@/scripts/utils/language-icons.tsx'
import React, { FC, useEffect, useRef, useState } from 'react'
import React, { useEffect, useRef, useState } from 'react'
import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter'
import createElement from 'react-syntax-highlighter/dist/cjs/create-element'

Expand All @@ -13,7 +13,7 @@ interface LineProps {
showLineNumbers: boolean
}

const Line: FC<LineProps> = ({ lineNumber, children, showLineNumbers }) => (
const Line = ({ lineNumber, children, showLineNumbers }: LineProps) => (
<span className="flex">
{showLineNumbers && (
<span className="linenumber inline-block min-w-[2.75em] select-none pr-[1em] text-right text-muted-foreground">
Expand All @@ -40,7 +40,7 @@ interface CodeBlockProps {
removedLines?: [number, number][]
}

const CodeBlock: FC<CodeBlockProps> = ({
const CodeBlock = ({
src,
title,
range,
Expand All @@ -54,7 +54,7 @@ const CodeBlock: FC<CodeBlockProps> = ({
skipLines = [],
addedLines = [],
removedLines = [],
}) => {
}: CodeBlockProps) => {
const { code, loading } = useFetchData(src)
const textInput = useRef(null)
const [hovered, onEnter, onExit] = useHover()
Expand Down Expand Up @@ -124,15 +124,13 @@ const CodeBlock: FC<CodeBlockProps> = ({
)
) {
lineStyle.backgroundColor = 'rgba(233, 211, 182, 0.05)'
// lineStyle.width = '100%'
} else if (
removedLines.some(
([removedStart, removedEnd]) =>
lineNumber >= removedStart && lineNumber <= removedEnd
)
) {
lineStyle.backgroundColor = 'rgba(255, 0, 0, 0.1)'
// lineStyle.width = '100%'
removedCount++
}
return (
Expand Down Expand Up @@ -163,7 +161,6 @@ const CodeBlock: FC<CodeBlockProps> = ({
ref={textInput}
>
{loading ? (
// Loading circle using Tailwind
<div className="flex h-40 items-center justify-center">
<div className="h-12 w-12 animate-spin rounded-full border-t-2 border-border"></div>
</div>
Expand Down Expand Up @@ -225,18 +222,18 @@ const fetchData = async (src: string): Promise<string> => {

const useFetchData = (src?: string) => {
const [code, setCode] = useState<string>('')
const [loading, setLoading] = useState<boolean>(false) // Add a loading state
const [loading, setLoading] = useState<boolean>(false)

useEffect(() => {
if (src) {
setLoading(true) // Set loading to true before fetching
setLoading(true)
fetchData(src)
.then(setCode)
.finally(() => setLoading(false)) // Set loading to false after fetching
.finally(() => setLoading(false))
}
}, [src])

return { code, loading } // Return the loading state along with the code
return { code, loading }
}

const useHover = (): [
Expand Down
3 changes: 0 additions & 3 deletions components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { useEffect, useState } from 'react'
import Link from './Link'
import MobileNav from './MobileNav'
import SearchButton from './SearchButton'
import ThemeSwitch from './ThemeSwitch'
import { Button } from './shadcn/button'

const Header = () => {
Expand Down Expand Up @@ -60,7 +59,6 @@ const Header = () => {
className="px-3 py-2 text-sm font-medium text-muted-foreground hover:text-foreground"
>
<Link
// className="rounded px-3 py-2 text-sm font-medium text-muted-foreground transition-all duration-300 hover:bg-secondary hover:brightness-125"
href={link.href}
>
{link.title}
Expand All @@ -70,7 +68,6 @@ const Header = () => {
))}
</ul>
<SearchButton />
{/* <ThemeSwitch /> */}
<MobileNav />
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion components/shadcn/badge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const badgeVariants = cva(
'border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80',
destructive:
'border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80',
outline: 'text-foreground',
outline: 'border-border text-foreground',
},
},
defaultVariants: {
Expand Down
7 changes: 1 addition & 6 deletions data/authors/enscribe.mdx
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
---
name: enscribe
avatar: https://www.gravatar.com/avatar/bac00b54948ebf5ea072824aeafa890f
# occupation: Wizard of Earthsea
# company: Earthsea
twitter: https://twitter.com/enscry
# linkedin: https://www.linkedin.com/sparrowhawk
---

At birth, Ged was given the child-name Duny by his mother. He was born on the island of Gont, as a son of a bronzesmith. His mother died before he reached the age of one. As a small boy, Ged had overheard the village witch, his maternal aunt, using various words of power to call goats. Ged later used the words without an understanding of their meanings, to surprising effect.

The witch knew that using words of power effectively without understanding them required innate power, so she endeavored to teach him what little she knew. After learning more from her, he was able to call animals to him. Particularly, he was seen in the company of wild sparrowhawks so often that his "use name" became Sparrowhawk.
Hello!
2 changes: 1 addition & 1 deletion data/blog/actf-2023/gcd-query.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: "Ever wanted to guess an integer that's 617 digits long? Well, I did. Here's how I did it using ancient abacus math (Chinese Remainder Theorem)."
thumbnail: '/static/images/actf-2023/banner.svg'
images: ['/static/images/actf-2023/banner.webp']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/byuctf-2022/osint-compilation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: 'Discover various pertinent aspects of digital open-source intelligence. This is my OSINT writeup compilation for the BYUCTF 2022 capture-the-flag competition.'
thumbnail: '/static/images/byuctf-2022/banner.svg'
images: ['/static/images/byuctf-2022/banner.webp']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/dhhutc-2022/port-authority.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: 'Play a JSON-controlled strategy game through WebSocket—this is my writeup for the Hackazon Unlock the City programming challenge "Port Authority."'
thumbnail: '/static/images/dhhutc-2022/banner.svg'
images: ['/static/images/dhhutc-2022/banner.webp']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/idekctf-2023/nmpz.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: '"No moving, panning, or zooming" — a GeoGuessr-esque OSINT challenge testing geographical literacy.'
thumbnail: '/static/images/idekctf-2023/banner.png'
images: ['/static/images/idekctf-2023/banner.png']
layout: PostSimple
layout: PostLayout
---

![Banner](/static/images/idekctf-2023/banner.svg)
Expand Down
5 changes: 5 additions & 0 deletions data/blog/japan-retrospective/day-0/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ layout: PostBare
url: '/blog/japan-retrospective/day-4',
depth: 2,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
},
]}
title="Daily Log"
rightAlign
Expand Down
5 changes: 5 additions & 0 deletions data/blog/japan-retrospective/day-1/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ layout: PostBare
url: '/blog/japan-retrospective/day-4',
depth: 2,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
},
]}
title="Daily Log"
rightAlign
Expand Down
5 changes: 5 additions & 0 deletions data/blog/japan-retrospective/day-2/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ layout: PostBare
url: '/blog/japan-retrospective/day-4',
depth: 2,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
},
]}
title="Daily Log"
rightAlign
Expand Down
5 changes: 5 additions & 0 deletions data/blog/japan-retrospective/day-3/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ layout: PostBare
url: '/blog/japan-retrospective/day-4',
depth: 2,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
},
]}
title="Daily Log"
rightAlign
Expand Down
5 changes: 5 additions & 0 deletions data/blog/japan-retrospective/day-4/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ layout: PostBare
depth: 2,
active: true,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
},
]}
title="Daily Log"
rightAlign
Expand Down
76 changes: 76 additions & 0 deletions data/blog/japan-retrospective/day-5/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
title: 'A Retrospective on 14 Nights in Japan: Day 5'
date: '2024-04-11'
lastmod: '2024-04-11'
tags: ['personal', 'travel', 'culture']
authors: ['enscribe']
summary: 'I planned a 2-week trip to Japan during the summer of 2023 for my family. Here are some of the highlights, blunders, experiences gathered throughout the process.'
thumbnail: '/static/images/japan-retrospective/banner.webp'
images: ['/static/images/japan-retrospective/banner.webp']
draft: true
hidden: true
layout: PostBare
---

<div className="tocr not-prose">
<TOCInline
toc={[
{ value: 'Intro', url: '/blog/japan-retrospective#intro', depth: 1 },
{
value: 'Fundamentals',
url: '/blog/japan-retrospective#fundamentals',
depth: 1,
},
{
value: 'The Itinerary',
url: '/blog/japan-retrospective#the-itinerary',
depth: 1,
},
{
value: 'Daily Log',
url: '/blog/japan-retrospective#daily-log',
depth: 1,
},
{
value: 'Day 0: Arrival at KIX',
url: '/blog/japan-retrospective/day-0',
depth: 2,
},
{
value: 'Day 1: Osaka Day Trip',
url: '/blog/japan-retrospective/day-1',
depth: 2,
},
{
value: 'Day 2: Nara Day Trip',
url: '/blog/japan-retrospective/day-2',
depth: 2,
},
{
value: 'Day 3: East Kyoto',
url: '/blog/japan-retrospective/day-3',
depth: 2,
},
{
value: 'Day 4: West/Central Kyoto',
url: '/blog/japan-retrospective/day-4',
depth: 2,
},
{
value: 'Day 5: Fushimi Inari',
url: '/blog/japan-retrospective/day-5',
depth: 2,
active: true,
},
]}
title="Daily Log"
rightAlign
/>
</div>

## Day 5: Fushimi Inari

![Day 5 Map 1](/static/images/japan-retrospective/day-5-map-1.webp)

![Day 5 Map 2](/static/images/japan-retrospective/day-5-map-2.webp)

2 changes: 1 addition & 1 deletion data/blog/japan-retrospective/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ summary: 'I planned a 2-week trip to Japan during the summer of 2023 for my fami
thumbnail: '/static/images/japan-retrospective/banner.webp'
images: ['/static/images/japan-retrospective/banner.webp']
draft: true
layout: PostSimple
layout: PostLayout
---

![Intro Banner](/static/images/japan-retrospective/intro.webp)
Expand Down
2 changes: 1 addition & 1 deletion data/blog/mhsctf-2023/matchmaker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: 'Utilizing Edmonds’ beautifully crafted “Blossom algorithm” alongside graph theory to maximize weighted matchings.'
thumbnail: '/static/images/mhsctf-2023/banner.png'
images: ['/static/images/mhsctf-2023/banner.png']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/picoctf-2022/beginners-compilation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ['enscribe']
summary: 'Learn how to capture-the-flag with this compilation of in-depth writeups from picoCTF 2022. Covers introductory-level challenges in all categories!'
thumbnail: '/static/images/picoctf-2022/beginners-compilation/banner.svg'
images: ['/static/images/picoctf-2022/beginners-compilation/banner.webp']
layout: PostSimple
layout: PostLayout
# - ctfs/pico22/crypto/basic-mod1/
# - ctfs/pico22/crypto/basic-mod1-2/
# - ctfs/pico22/pwn/basic-file-exploit/
Expand Down
2 changes: 1 addition & 1 deletion data/blog/picoctf-2022/buffer-overflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ images: ['/static/images/picoctf-2022/buffer-overflow/banner.webp']
# - ctfs/pico22/crypto/pwn/buffer-overflow-1/
# - ctfs/pico22/crypto/pwn/buffer-overflow-2/
# - ctfs/pico22/crypto/pwn/buffer-overflow-3/
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/sekaictf-2022/forensics-writeup-compilation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ summary: 'An organizer-written writeup compilation for selected forensics challe
thumbnail: '/static/images/sekaictf-2022/banner.png'
images: ['/static/images/sekaictf-2022/banner.png']
authors: ['enscribe']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/sekaictf-2023/azusawas-gacha-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ summary: "I created a fully functional, hackable replica of Project Sekai's gach
thumbnail: '/static/images/sekaictf-2023/banner.png'
images: ['/static/images/sekaictf-2023/banner.webp']
authors: ['enscribe']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/shctf-2022/compilation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ images: ['/static/images/shctf-2022/banner.webp']
# - ctfs/shctf/pwn/vader/
# - ctfs/shctf/pwn/warmup-to-the-dark-side/
# - ctfs/shctf/crypto/rahools-challenge/
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
2 changes: 1 addition & 1 deletion data/blog/wolvctf-2023/wannaflag-series.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ summary: 'Hunting down a flag-stealing ransomware group with the power of OSINT
thumbnail: '/static/images/wolvctf-2023/banner.svg'
images: ['/static/images/wolvctf-2023/banner.png']
authors: ['enscribe']
layout: PostSimple
layout: PostLayout
---

## Intro
Expand Down
Loading

0 comments on commit 55b8b82

Please sign in to comment.