View commands.sh
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
# check status | |
sudo ufw status | |
# deny all incoming | |
sudo ufw default deny incoming | |
# allow from a specific source IP address or entire subnet to connect to our port 22 | |
sudo ufw allow from 192.168.1.0/24 to any port 22 proto tcp | |
# enable the ufw | |
sudo ufw enable |
View game.py
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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
"""An easy action adventure game based on text.""" | |
import random | |
import time | |
import uuid | |
from typing import Dict, Generator, List, Protocol |
View query.py
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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
import mmap | |
import struct | |
import socket | |
import pathlib | |
from typing import Tuple |
View 24-game.py
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
#!/usr/bin/env python3 | |
# -*- coding:utf-8 -*- | |
import itertools | |
from typing import Optional | |
from expression import Expr | |
from fraction import Frac |
View number.py
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
#!/usr/bin/env python3 | |
# _*_ coding:utf-8 _*_ | |
import re | |
def str_to_int(s: str) -> int: | |
if not s: | |
return 0 | |
i = ord(s[0]) - ord("0") |
View stream.py
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
#!/usr/bin/env python3 | |
def cons_stream(head, tail): | |
return (head, delay(tail)) | |
def head(s): | |
return s[0] | |
View value.rs
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
use std::collections::HashMap; | |
use std::fmt; | |
use std::ops::Add; | |
use std::sync::Arc; | |
struct Procedure { | |
name: String, | |
inner_proc: Arc<dyn Fn(Vec<Value>) -> Value>, | |
} |
View vigenere_cipher.py
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
#!/usr/bin/env python | |
import string | |
import textwrap | |
import functools | |
def filter_not_upper(text: str) -> str: | |
return "".join(filter(lambda c: c in string.ascii_uppercase, text)) |
View father-puzzle.pl
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
/* Who is Lorna's father? | |
* | |
* Mary Ann Moore’s father has a yacht and so has each of his four friends: Colonel Downing, Mr. Hall, Sir Barnacle Hood, and Dr. Parker. | |
* 1. Each of the five also has one daughter and each has named his yacht after a daughter of one of the others. | |
* 2. Sir Barnacle’s yacht is the Gabrielle. | |
* 3. Mr. Moore owns the Lorna. | |
* 4. Mr. Hall the Rosalind. | |
* 5. The Melissa, owned by Colonel Downing, is named after Sir Barnacle’s daughter. | |
* 6. Gabrielle’s father owns the yacht that is named after Dr. Parker’s daughter. | |
*/ |
View liars-puzzle.pl
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
/* What in fact was the order in which the five girls were placed? | |
* | |
* Five schoolgirls sat for an examination. Their parents--so they thought--showed an undue degree of interest | |
* in the result. They therefore agreed that, in writing home about the examination, each girl should make one | |
* true statement and one untrue one. The following are the relevant passages from their letters: | |
* | |
* 1. Betty: "Kitty was second in the examination. I was only third." | |
* 2. Ethel: "You'll be glad to hear that I was on top. Joan was 2nd." | |
* 3. Joan: "I was third, and poor old Ethel was bottom." | |
* 4. Kitty: I came out second. Mary was only fourth." |
NewerOlder