This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Delete the current firewall setup: | |
iptables -F | |
# Define default rules for all chains: | |
iptables -P INPUT DROP | |
iptables -P FORWARD DROP | |
# Allow incoming/outgoing localhost frames for tests (e.g. Webserver, Mailserver): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tryCatch<T>(fn: () => T, andFinally?: () => void): Result<T, string> { | |
try { | |
return Ok(fn()); | |
} catch (err) { | |
return Err(`Fn threw an error ${err}`); | |
} finally { | |
andFinally?.(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface SomeType<T> { | |
type: "some"; | |
value: T; | |
/*** Returns the value of the Option if it exists, otherwise throws an error.*/ | |
unwrap(): T; | |
/*** Returns the value of the Option if it exists, otherwise returns the provided default value.*/ | |
unwrapOr(defaultValue: T): T; | |
/*** Returns the value of the Option if it exists, otherwise calls the provided function and returns its result.*/ | |
unwrapOrElse(fn: () => T): T; | |
/*** Returns true if the Option contains a value, false otherwise.*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Component from "./Component"; | |
import "./styles.css"; | |
import { useState } from "react"; | |
import { Check, Random } from "./random"; | |
/** | |
* @Question | |
*Implement a theme switcher.that can switch between themes in entire application. | |
*/ |