Skip to content

Instantly share code, notes, and snippets.

def search(grid_dict):
# try to solve the board
grid_dict = run_episode(grid_dict)
if grid_dict is False:
# it means the current configuration of the board is unsolvable
# this happens when any of the boxes have no possible value to fix
def run_episode(grid_dict):
stuck = False
while not stuck:
# Check how many boxes have a fixed value
solved_values_before = len([box for box in grid_dict.keys() if len(grid_dict[box]) == 1])
# Use the Eliminate Strategy
grid_dict = eliminate(grid_dict)
# Use the Only Choice Strategy
@zahash
zahash / movie_magnet.py
Last active April 27, 2020 06:25
get torrent magnet links of movies
#! /usr/bin/env python3
"""
Install these packages before running the script
beautifulsoup4==4.9.0
bs4==0.0.1
certifi==2020.4.5.1
chardet==3.0.4
idna==2.9
def numerical_input_processor(inputs):
if not inputs:
return
concat = None
if len(inputs.values()) > 1:
concat = tf.keras.layers.Concatenate()(list(inputs.values()))
norm = tf.keras.layers.experimental.preprocessing.Normalization()
def string_input_processor(inputs):
if not inputs:
return
vocabularies = defaultdict(set)
for batch, _ in get_dataset(batch_size=BATCH_SIZE):
for col_name in inputs.keys():
for st in np.array(batch[col_name]).astype("str"):
vocabularies[col_name].add(st.lower().strip())
def model_builder(hp):
if TASK == "r":
loss_fn = "mean_absolute_error"
elif TASK == "c":
if OUTPUT_NODES == 1:
loss_fn = tf.keras.losses.BinaryCrossentropy(from_logits=True)
else:
loss_fn = tf.keras.losses.SparseCategoricalCrossentropy(from_logits=True)
if TASK == "r":
sudo apt install docker.io
# add user to docker group for non-sudo access
sudo groupadd docker # add docker group
sudo usermod -aG docker $USER # add your user to the docker group.
newgrp docker # activate the changes to groups. Run this command on each new terminal session
docker ps # verify that user can run Docker without sudo