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
'''ISO-8601 date regex with leap-year validation.''' | |
import re | |
date_regex = re.compile(r"^(\d{4}-((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01])|(0[469]|11)-(0[1-9]|[12][0-9]|30)|02-(0[1-9]|1[0-9]|2[0-8]))|(\d{2}(0[48]|[2468][048]|[13579][26])|([02468][48]|[13579][26])00)-02-29)$") | |
# Piece-wise regex by month/leap year: | |
# | |
# 31 days: Jan/Mar/May/Jul/Aug/Oct/Dec | |
# \d{4}-(0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]) |
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 <iostream> | |
#include "Vec3.hpp" | |
int main() { | |
Vec3<int> first = {1, 2, 3}; | |
Vec3<int> second = first + 2; | |
Vec3<double> third = first + 1.5; | |
Vec3<double> fourth = 2.5 + first; | |
Vec3<double> fifth = {1.0, 2.0, 3.0}; | |
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
53 7 | |
6 195 | |
98 6 | |
8 6 3 | |
4 8 3 1 | |
7 2 6 | |
6 28 | |
419 5 | |
8 79 |
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 | |
## | |
## Maintainer: [[User:Nahiyan8]] @ Wikimedia (en, bn) | |
## Copyright: Public domain, but I don't think anyone will be able to modify this... | |
## Created in: 2014-11-22 | |
## Last modified: 2014-11-22 | |
## | |
## |
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
#ifndef UTILS_MSTORE_HPP_INCLUDED | |
#define UTILS_MSTORE_HPP_INCLUDED | |
// C++ version of stdlib.h used, so that its memory free() function can be distinguished from mstore::free | |
#include <cstdlib> | |
#include <string.h> | |
#include <stddef.h> | |
#include <stdint.h> | |
#include <stdbool.h> | |
#include <limits.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 <stdio.h> | |
#include <sys/socket.h> | |
#include <netinet/in.h> | |
#include <netinet/ip.h> | |
#define LISTEN_PORT (1234) | |
#define ASSERT_FATAL(condition, function) \ | |
do { \ | |
if ((condition)) { \ | |
perror((function)); \ |
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
CC=g++ | |
CPPFLAGS=-m64 -std=c++11 -pedantic -Wall -Wshadow -Wpointer-arith -Wcast-qual -Wno-switch | |
BIN=$(patsubst %.cpp,bin/%,$(wildcard *.cpp)) | |
all: $(BIN) | |
bin/%: %.cpp | |
mkdir -p bin/ | |
$(CC) $(CPPFLAGS) $< -o $@ |