{
    "archive_path": "archive/1733168157.835339",
    "base_url": "gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080",
    "basename": "c580ccefb8f0e46d31b49902aed09080",
    "bookmarked_date": "2024-12-02 19:35",
    "canonical": {
        "archive_org_path": "https://web.archive.org/web/gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080",
        "dom_path": "output.html",
        "favicon_path": "favicon.ico",
        "git_path": "git/",
        "google_favicon_path": "https://www.google.com/s2/favicons?domain=gist.github.com",
        "headers_path": "headers.json",
        "htmltotext_path": "htmltotext.txt",
        "index_path": "index.html",
        "media_path": "media/",
        "mercury_path": "mercury/content.html",
        "pdf_path": "output.pdf",
        "readability_path": "readability/content.html",
        "screenshot_path": "screenshot.png",
        "singlefile_path": "singlefile.html",
        "warc_path": "warc/",
        "wget_path": null
    },
    "domain": "gist.github.com",
    "downloaded_at": "2024-12-02T19:35:59.981471+00:00",
    "downloaded_datestr": "2024-12-02 19:35",
    "extension": "",
    "hash": "VHKY4CZD5SD2RDEX5FVW",
    "history": {
        "archive_org": [
            {
                "cmd": [
                    "/usr/bin/curl",
                    "--silent",
                    "--location",
                    "--compressed",
                    "--proxy",
                    "socks5://tor-socks-proxy:9150",
                    "--head",
                    "--max-time",
                    "60",
                    "--user-agent",
                    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)",
                    "https://web.archive.org/save/https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "8.10.1",
                "end_ts": "2024-12-02T19:36:44.102876+00:00",
                "index_texts": null,
                "output": "ArchiveError: Failed to find \"content-location\" URL header in Archive.org response.",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:42.552503+00:00",
                "status": "failed"
            }
        ],
        "dom": [
            {
                "cmd": [
                    "/usr/bin/chromium-browser",
                    "--proxy-server=socks5://tor-socks-proxy:9150",
                    "--disable-features=DarkMode",
                    "--run-all-compositor-stages-before-draw",
                    "--hide-scrollbars",
                    "--autoplay-policy=no-user-gesture-required",
                    "--no-first-run",
                    "--use-fake-ui-for-media-stream",
                    "--use-fake-device-for-media-stream",
                    "--simulate-outdated-no-au='Tue, 31 Dec 2099 23:59:59 GMT'",
                    "--headless=new",
                    "--no-sandbox",
                    "--no-zygote",
                    "--disable-dev-shm-usage",
                    "--disable-software-rasterizer",
                    "--disable-sync",
                    "--window-size=1440,2000",
                    "--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)",
                    "--user-data-dir=/data/personas/Default/chrome_profile",
                    "--profile-directory=Default",
                    "--dump-dom",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "131.0.6778",
                "end_ts": "2024-12-02T19:36:20.244278+00:00",
                "index_texts": null,
                "output": "output.html",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:11.809218+00:00",
                "status": "succeeded"
            }
        ],
        "favicon": [
            {
                "cmd": [
                    "/usr/bin/curl",
                    "--silent",
                    "--location",
                    "--compressed",
                    "--proxy",
                    "socks5://tor-socks-proxy:9150",
                    "--max-time",
                    "60",
                    "--output",
                    "favicon.ico",
                    "--user-agent",
                    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)",
                    "https://www.google.com/s2/favicons?domain=gist.github.com"
                ],
                "cmd_version": "8.10.1",
                "end_ts": "2024-12-02T19:36:05.029693+00:00",
                "index_texts": null,
                "output": "favicon.ico",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:00.859390+00:00",
                "status": "succeeded"
            }
        ],
        "git": [],
        "headers": [
            {
                "cmd": [
                    "/usr/bin/curl",
                    "--silent",
                    "--location",
                    "--compressed",
                    "--proxy",
                    "socks5://tor-socks-proxy:9150",
                    "--head",
                    "--max-time",
                    "60",
                    "--user-agent",
                    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "8.10.1",
                "end_ts": "2024-12-02T19:36:05.424758+00:00",
                "index_texts": null,
                "output": "headers.json",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:05.074178+00:00",
                "status": "succeeded"
            }
        ],
        "htmltotext": [
            {
                "cmd": [
                    "(internal) archivebox.extractors.htmltotext",
                    "./{singlefile,dom}.html"
                ],
                "cmd_version": "0.8.5rc51",
                "end_ts": "2024-12-02T19:36:35.338524+00:00",
                "index_texts": [
                    "(https://github.githubassets.com) (https://avatars.githubusercontent.com) (https://github-cloud.s3.amazonaws.com) (https://user-images.githubusercontent.com/) (https://github.githubassets.com) (https://avatars.githubusercontent.com) (https://github.githubassets.com/assets/light-3e154969b9f9.css) (https://github.githubassets.com/assets/dark-9c5b7a476542.css) (https://github.githubassets.com/assets/primer-primitives-4cf0d59ab51a.css) (https://github.githubassets.com/assets/primer-af846850481e.css) (https://github.githubassets.com/assets/global-8b10f05a77e6.css) (https://github.githubassets.com/assets/github-2f6e722088eb.css) Buy/Sell \u00b7 GitHub (gist_code) (https://github.githubassets.com/) (/opensearch-gist.xml) (Gist) (https://gist.github.com/fluidicon.png) (GitHub) (/avimoondra.atom) (atom) (https://github.githubassets.com/assets/gist-622547bb175b.css) (https://github.githubassets.com/assets/pinned-octocat-093da3e6fa40.svg) (https://github.githubassets.com/favicons/favicon.png) (https://github.githubassets.com/favicons/favicon.svg)  Skip to content   (https://github.githubassets.com/assets/primer-react.9fa170e9435ed4b922b9.module.css)    (/)             (Search\u2026)    (/discover) All gists (https://github.com) Back to GitHub (https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080) Sign in  (/join?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080&source=header-gist) Sign up    (/)         (https://gist.github.com/auth/github?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080) Sign\u00a0in  (/join?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080&source=header-gist) Sign\u00a0up      You signed in with another tab or window. () Reload to refresh your session. You signed out in another tab or window. () Reload to refresh your session. You switched accounts on another tab or window. () Reload to refresh your session.    Dismiss alert     Instantly share code, notes, and snippets.    (/avimoondra) (@avimoondra)   (/avimoondra) avimoondra  / (/avimoondra/c580ccefb8f0e46d31b49902aed09080) spec.md  (Only those with the link can see this gist.) Secret    Last active (Jun 8, 2021, 5:43 PM UTC) June 8, 2021 17:43         Show Gist options (/avimoondra/c580ccefb8f0e46d31b49902aed09080/archive/22299efd1c4ae19c280134b1b6f78e14011dd995.zip) Download ZIP             (/login?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080)    Star ((0) 0 ) (0) 0    You must be signed in to star a gist  (/login?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080)    Fork ((0) 0 ) (0) 0    You must be signed in to fork a gist     Embed        (<script src=\"https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js\"></script>)    Embed  Embed this gist in your website.    (https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080)    Share  Copy sharable link for this gist.    (https://gist.github.com/c580ccefb8f0e46d31b49902aed09080.git)    Clone via HTTPS  Clone using the web URL.     (https://docs.github.com/articles/which-remote-url-should-i-use)       Learn more about clone URLs            Clone this repository at &lt;script src=&quot;https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js&quot;&gt;&lt;/script&gt;  (<script src=\"https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js\"></script>)                     (https://desktop.github.com)     Save avimoondra/c580ccefb8f0e46d31b49902aed09080 to your computer and use it in GitHub Desktop.   (/avimoondra/c580ccefb8f0e46d31b49902aed09080)   Code  (/avimoondra/c580ccefb8f0e46d31b49902aed09080/revisions)   Revisions (11) 11      Embed        (<script src=\"https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js\"></script>)    Embed  Embed this gist in your website.    (https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080)    Share  Copy sharable link for this gist.    (https://gist.github.com/c580ccefb8f0e46d31b49902aed09080.git)    Clone via HTTPS  Clone using the web URL.     (https://docs.github.com/articles/which-remote-url-should-i-use)       Learn more about clone URLs            Clone this repository at &lt;script src=&quot;https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js&quot;&gt;&lt;/script&gt;  (<script src=\"https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080.js\"></script>)                    (https://desktop.github.com)     Save avimoondra/c580ccefb8f0e46d31b49902aed09080 to your computer and use it in GitHub Desktop.  (/avimoondra/c580ccefb8f0e46d31b49902aed09080/archive/22299efd1c4ae19c280134b1b6f78e14011dd995.zip) Download ZIP      Buy/Sell  (/avimoondra/c580ccefb8f0e46d31b49902aed09080/raw/22299efd1c4ae19c280134b1b6f78e14011dd995/spec.md) Raw       spec.md     Buy/Sell     Given a list of stock prices (ordered by time), we want to write a function for the max profit you can make from buying the stock at one point in time, and selling it a later point in time. In the example below, we'd return a profit of $10 by buying at $1 and selling at $11. Function: buy_sell(prices: Number[])\nInput: [3, 5, 1, 7, 8, 10, 11, 2]\nOutput: [10, 1, 11]\nExample: buy_sell([3, 5, 1, 7, 8, 10, 11, 2]) == [10, 1, 11]   Requirements: You cannot buy and sell in the same day You must buy before you sell (i.e. no shorts) You must make exactly 1 trade If the prices are decreasing, we'd minimize loss (return the least negative profit) Stock prices will always be an array of positive integers, with at least 2 prices Output format: [<profit>, <purchase_price>, <sell_price>]   Space constraints : O(n), n = # of prices Run time constraints : None. There is no penalty for greater than O(n) run time. In fact, we prefer arriving more quickly at a solution that's optimized for readability, NOT run time.        (/join?source=comment-gist) Sign up for free to join this conversation on GitHub .\n    Already have an account? (/login?return_to=https%3A%2F%2Fgist.github.com%2Favimoondra%2Fc580ccefb8f0e46d31b49902aed09080) Sign in to comment           Footer (GitHub) (https://github.com)    \u00a9 2024 GitHub,\u00a0Inc.   Footer navigation (https://docs.github.com/site-policy/github-terms/github-terms-of-service) Terms  (https://docs.github.com/site-policy/privacy-policies/github-privacy-statement) Privacy  (https://github.com/security) Security  (https://www.githubstatus.com/) Status  (https://docs.github.com/) Docs  (https://support.github.com?tags=dotcom-footer) Contact  Manage cookies    Do not share my personal information              You can\u2019t perform that action at this time.         "
                ],
                "output": "htmltotext.txt",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:35.275812+00:00",
                "status": "succeeded"
            }
        ],
        "media": [
            {
                "cmd": [
                    "/usr/local/bin/yt-dlp",
                    "--restrict-filenames",
                    "--trim-filenames",
                    "128",
                    "--write-description",
                    "--write-info-json",
                    "--write-annotations",
                    "--write-thumbnail",
                    "--no-call-home",
                    "--write-sub",
                    "--write-auto-subs",
                    "--convert-subs=srt",
                    "--yes-playlist",
                    "--continue",
                    "--no-abort-on-error",
                    "--ignore-errors",
                    "--geo-bypass",
                    "--add-metadata",
                    "--format=(bv*+ba/b)[filesize<=750m][filesize_approx<=?750m]/(bv*+ba/b)",
                    "--skip-download",
                    "--cache-dir=/data/yt-dlp-cache/",
                    "--cookies=/data/yt-dlp-cache/cookies.txt",
                    "--proxy=socks5://tor-socks-proxy:9150",
                    "--no-playlist",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "2024.10.7",
                "end_ts": "2024-12-02T19:36:42.513863+00:00",
                "index_texts": [],
                "output": "media/",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:37.130845+00:00",
                "status": "succeeded"
            }
        ],
        "mercury": [
            {
                "cmd": [
                    "/home/archivebox/.npm/bin/postlight-parser",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "2.2.3",
                "end_ts": "2024-12-02T19:36:35.216357+00:00",
                "index_texts": null,
                "output": "mercury/",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:31.391493+00:00",
                "status": "succeeded"
            }
        ],
        "pdf": [],
        "readability": [
            {
                "cmd": [
                    "/home/archivebox/.npm/bin/readability-extractor",
                    "/tmp/tmp7kz16uqb",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "0.0.11",
                "end_ts": "2024-12-02T19:36:24.444511+00:00",
                "index_texts": [
                    "Buy/Sell\nGiven a list of stock prices (ordered by time), we want to write a function for the max profit you can make from buying the stock at one point in time, and selling it a later point in time.\nIn the example below, we'd return a profit of $10 by buying at $1 and selling at $11.\nFunction: buy_sell(prices: Number[])\nInput: [3, 5, 1, 7, 8, 10, 11, 2]\nOutput: [10, 1, 11]\nExample: buy_sell([3, 5, 1, 7, 8, 10, 11, 2]) == [10, 1, 11]\n\nRequirements:\n\nYou cannot buy and sell in the same day\nYou must buy before you sell (i.e. no shorts)\nYou must make exactly 1 trade\nIf the prices are decreasing, we'd minimize loss (return the least negative profit)\nStock prices will always be an array of positive integers, with at least 2 prices\nOutput format: [<profit>, <purchase_price>, <sell_price>]\n\nSpace constraints: O(n), n = # of prices\nRun time constraints: None. There is no penalty for greater than O(n) run time. In fact, we prefer arriving more quickly at a solution that's optimized for readability, NOT run time."
                ],
                "output": "readability/",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:21.609964+00:00",
                "status": "succeeded"
            }
        ],
        "screenshot": [],
        "singlefile": [],
        "title": [
            {
                "cmd": [
                    "/usr/bin/curl",
                    "--silent",
                    "--location",
                    "--compressed",
                    "--proxy",
                    "socks5://tor-socks-proxy:9150",
                    "--max-time",
                    "60",
                    "--user-agent",
                    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 ArchiveBox/{VERSION} (+https://github.com/ArchiveBox/ArchiveBox/)",
                    "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
                ],
                "cmd_version": "8.10.1",
                "end_ts": "2024-12-02T19:36:20.369987+00:00",
                "index_texts": null,
                "output": "Buy/Sell \u00b7 GitHub",
                "pwd": "/data/archive/1733168157.835339",
                "schema": "ArchiveResult",
                "start_ts": "2024-12-02T19:36:20.305240+00:00",
                "status": "succeeded"
            }
        ],
        "wget": []
    },
    "icons": null,
    "is_archived": true,
    "is_static": false,
    "latest": {
        "archive_org": "ArchiveError: Failed to find \"content-location\" URL header in Archive.org response.",
        "dom": "output.html",
        "favicon": "favicon.ico",
        "git": null,
        "media": "media/",
        "pdf": null,
        "screenshot": null,
        "singlefile": null,
        "title": "Buy/Sell \u00b7 GitHub",
        "warc": null,
        "wget": null
    },
    "link_dir": "/data/archive/1733168157.835339",
    "newest_archive_date": "2024-12-02T19:36:42.552503+00:00",
    "num_failures": 1,
    "num_outputs": 8,
    "oldest_archive_date": "2024-12-02T19:36:00.859390+00:00",
    "path": "/avimoondra/c580ccefb8f0e46d31b49902aed09080",
    "schema": "Link",
    "scheme": "https",
    "snapshot_abid": "snp_01JE4DYN61284154B5014WYZYH",
    "snapshot_id": "167382e6-1910-4f83-880c-d76d09cf7fd1",
    "sources": [
        "/data/sources/1733168156-import.txt"
    ],
    "tags": null,
    "tags_str": "",
    "timestamp": "1733168157.835339",
    "title": "Buy/Sell \u00b7 GitHub",
    "url": "https://gist.github.com/avimoondra/c580ccefb8f0e46d31b49902aed09080"
}