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
''' | |
Code to solve the puzzle [Circular Prison of Unknown Size](https://puzzling.stackexchange.com/questions/16168/the-circular-prison-of-unknown-size) | |
''' | |
import random | |
import logging | |
from itertools import chain, combinations | |
def powerset(iterable): | |
"powerset([1,2,3]) --> () (1,) (2,) (3,) (1,2) (1,3) (2,3) (1,2,3)" |
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 random | |
import logging | |
log = logging.getLogger(__name__) | |
MAX_NUM_PRISONERS = 12 | |
NUM_PRISONERS = random.randrange(2, MAX_NUM_PRISONERS + 1) | |
def main(): | |
print(f'Number of prisoners: {NUM_PRISONERS}') |
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
#define WIFI_SSID "" | |
#define WIFI_PW "" | |
#define KEY "" | |
#define API_URL "" | |
#define NAME "" | |
#define ROLE "" | |
#include <ESP8266WiFi.h> | |
#include <ESP8266mDNS.h> | |
#include <WiFiUdp.h> |
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
#include <ESP8266WiFi.h> | |
#include <ESP8266mDNS.h> | |
#include <WiFiUdp.h> | |
#include <ArduinoOTA.h> | |
const char* ssid = "..."; | |
const char* password = "..."; | |
void setup() { | |
Serial.begin(115200); |
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
dbe = sqlalchemy.create_engine(config.DB_URL, isolation_level='SERIALIZABLE') | |
dbs = scoped_session(sessionmaker(bind=dbe, autoflush=True, autocommit=False)) | |
in_dbt = False | |
tdata = dict() | |
in_retry = False | |
@contextmanager | |
def dbt_cm(save=True, top=False, _retry=False): | |
global in_dbt | |
global in_nested_dbt |