Skip to content

Instantly share code, notes, and snippets.

View thearyanahmed's full-sized avatar

Aryan Ahmed thearyanahmed

View GitHub Profile
#include <stdio.h>
int main() {
int year, nearestLeap;
printf("Enter a year: ");
scanf("%d", &year);
if ((year % 4 == 0 && year % 100 != 0) || (year % 400 == 0)) {
printf("%d is a leap year.\n", year);
{
"editor.scrollBeyondLastLine": true,
"editor.tabSize": 4,
"files.autoSaveDelay": 1000,
"editor.smoothScrolling": true,
"workbench.startupEditor": "none",
"files.autoSave": "afterDelay",
"editor.renderWhitespace": "none",
"editor.cursorStyle": "line-thin",
"editor.fontSize": 12,
<svg viewBox="110 0 190 280" width="100%" >
<circle id="sun-outer" cx="210.244" cy="97.409" r="70"></circle>
<circle id="sun-inner" cx="210.244" cy="97.409" r="55"></circle>
<circle id="sun" cx="210.244" cy="97.409" r="40"></circle>
<path
d="M 211.278 120.999 C 205.66 122.333 201.013 123.476 200.952 123.541 C 200.819 123.681 197.736 157.278 197.742 158.534 C 197.742 159.014 198.062 159.409 198.452 159.409 C 198.842 159.409 201.712 160.219 204.828 161.206 C 212.998 163.796 221.226 163.319 226.701 159.936 C 227.258 159.591 222.266 119.079 221.614 118.656 C 221.548 118.611 216.897 119.666 211.278 121"
fill-rule="evenodd" style="fill: rgb(234, 242, 255);"></path>
<path fill="#fd765d"
d="M 205.796 72.534 C 204.638 73.154 203.23 74.39 202.668 75.284 L 201.426 76.689 L 209.712 76.909 C 219.087 77.275 218.667 76.899 215.412 73.816 C 212.617 71.168 209.204 70.713 205.796 72.534"
fill-rule="evenodd"></path>
@thearyanahmed
thearyanahmed / LazyImage.tsx
Created January 1, 2025 10:09
Lazy image thingy
import { useState, useEffect, useRef } from "react";
const LazyImage = ({ src, alt, className }) => {
const [isVisible, setIsVisible] = useState(false);
const imgRef = useRef(null);
useEffect(() => {
const observer = new IntersectionObserver(
([entry]) => {
if (entry.isIntersecting) {
sudo mkdir -p /tmp/rootfs
sudo mkdir -p /tmp/container

# Mount root filesystem in read-only mode

sudo mount --bind -o readonly /tmp/rootfs /tmp/container

# Mount the proc filesystem
@thearyanahmed
thearyanahmed / distance.go
Created November 4, 2022 17:36 — forked from hotdang-ca/distance.go
Golang code to calculate distance between two lat/lng decimal coordinates.
package main
import (
"math"
"fmt"
)
//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
//::: :::
//::: This routine calculates the distance between two points (given the :::
@thearyanahmed
thearyanahmed / golang_job_queue.md
Created October 27, 2022 15:34 — forked from harlow/golang_job_queue.md
Job queues in Golang

Rough Notes about CQRS and ES

Once upon a time…

I once took notes (almost sentence by sentence with not much editing) about the architectural design concepts - Command and Query Responsibility Segregation (CQRS) and Event Sourcing (ES) - from a presentation of Greg Young and published it as a gist (with the times when a given sentence was heard).

I then found other summaries of the talk and the gist has since been growing up. See the revisions to know the changes and where they came from (aka the sources).

It seems inevitable to throw Domain Driven Design (DDD) in to the mix.

@thearyanahmed
thearyanahmed / nextjs-deploy.md
Created September 20, 2022 15:25 — forked from jjcodes78/nextjs-deploy.md
Deploying NEXTJS site with nginx + pm2

How to setup next.js app on nginx with letsencrypt

next.js, nginx, reverse-proxy, ssl

1. Install nginx and letsencrypt

$ sudo apt-get update
$ sudo apt-get install nginx letsencrypt

Also enable nginx in ufw