Skip to content

Instantly share code, notes, and snippets.

View francescogior's full-sized avatar
🤔
I am thinking

Francesco Giordano francescogior

🤔
I am thinking
View GitHub Profile
@francescogior
francescogior / rename-files.js
Last active June 16, 2022 07:07
rename-files.js
const fs = require("fs");
const path = require("path");
const dir = process.argv.slice(2)[0];
if (dir == null) throw new Error("No directory provided");
const files = fs
.readdirSync(dir, { withFileTypes: true })
.filter((item) => item.isFile());

Secretary Problem

Riddle

A manager wants to hire $1$ secretary among $N$ candidates with the following rules:

  • He interviews each candidate in a given order
  • Each candidate after the interview is either irrevocably rejected or hired (thus preventing the necessity to interview the next candidates)

He decides to use the following method:

Whiteboard = require '../whiteboard/controller'
module.exports = (io) ->
io.on 'connection', (socket) ->
socket.on 'get socket', (whiteboardId) ->
socket.join whiteboardId