Skip to content

Instantly share code, notes, and snippets.

View lomnom's full-sized avatar
💭
Duh Ta an be web fox do has dan no eh Ta so VHS TN bc so it’s damn ya so thx sag

lomnom

💭
Duh Ta an be web fox do has dan no eh Ta so VHS TN bc so it’s damn ya so thx sag
View GitHub Profile
@lomnom
lomnom / Yes.py
Last active February 12, 2024 22:54
Hello world landscape
'The peaks of Mt. CodeMore are carpeted with an impenetrable armour of snow.'
"""Below that snow lies sparkly logic."""
#
#-##
##-#.
@print ###
@ ( ##-###.
lambda ###=# ##
a ## #=
> v
1 #
2 vtv#<
3 # # t
4 v<v< >#vtv
5 t t # #
6 v<v<
7 t t
8
SXY vvvv vvvv

Noi notes

Boilerplate

Template

#include <iostream>
#define num long int

using namespace std;

int main(){
@lomnom
lomnom / Download.js
Last active May 4, 2025 14:36
Tapermonkey script that adds the download button to lectures on NYJCPortal/NYPortal
// ==UserScript==
// @name NYJC download
// @namespace https://tampermonkey.net/
// @version 2025-03-02
// @description Adds the download button to lectures on the NYJCportal. https://gist.github.com/lomnom/a0c51d25a65198eba13333d6395e9bb1
// @author lomnom on github
// @match portal.nyjc.edu.sg/*
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant none
// ==/UserScript==
@lomnom
lomnom / Solution.md
Last active July 5, 2025 14:15
NYRCS pset 7 - Hints

Hints & solutions

Wormholes

Hint 1 When defining a DP function, think about all the possible ways to get to where you are from ONE step before.

Also assume that if your cases are correct, all your dp results are correct.

@lomnom
lomnom / Answers.md
Last active July 29, 2025 07:13
Code for subgraphs

2 Solutions for Subgraphs

Smart loop

Uses the vector visited.

Special optimization:

  1. With the vector visited,
  2. for (int i = 0; i<nodes; i++){
  3. if (!visited[i]){do bfs and increment the counter by 1}

This avoids iterating through the whole visited vector every time. It only does so once.

@lomnom
lomnom / Hints.md
Last active July 30, 2025 08:48
Pset 9 hints

Hints

Subgraphs

Hint #1 Use DFS for this. Approach is the same as with BFS (refer to session 7 slides), except that you use DFS.

Dijkstra

Details Hint #0
@lomnom
lomnom / Solutions.md
Last active August 6, 2025 08:38
Pset 9 solutions

Dijkstra

#include <iostream>
#include <queue>
#include <vector>
#include <limits.h>

using namespace std;

typedef long long int ll;
@lomnom
lomnom / cms.md
Last active November 5, 2025 17:59
Setting up Contest Management System on a raspberry pi 3A

Steps taken to get cms up and running

Cms was installed onto a raspberry pi running 64x raspbian through docker. This document details the process. It assumes you are working from the terminal.

Before everything

sudo apt-get update && sudo apt-get upgrade to have up-to-date apt info

Get CMS source

Note that we install through the docker route to avoid the suffering that comes with manually resolving dependencies.

  1. Install git thru apt with sudo apt-get install git.
@lomnom
lomnom / Hints11.md
Last active October 22, 2025 00:55
Hints for NYRCS pset 11: PURQ segtree

Hints

Segment tree

Hint #1 This questions wants you to implement a conventional segment tree. You can use the nyrcs template
Hint #2 It wants you to find the minimum instead of the sum. How do you do that?