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
@echo off | |
rem = """ | |
rem This is a hybrid batch and Python script. The batch (right here) invokes | |
rem the Python script and treats its standard output as a list of environment | |
rem variables to set in the current environment. | |
rem The -x argument causes the Python interpreter to ignore the first line. | |
rem The -S argument disables the implicit 'site' package import (speed go fast). | |
FOR /F "tokens=1,2 delims==" %%v IN ('python -x -S "%~f0" %*') DO SET %%v=%%w | |
GOTO :eof | |
""" |
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
Show hidden characters
{ | |
"shell_cmd": "\"%VS120COMNTOOLS%\\..\\..\\VC\\vcvarsall.bat\" amd64 && cl /nologo \"$file\"", | |
"file_regex": "^(.*?)\\(([0-9+])(?:,([0-9+]))?\\)\\s+:\\s+(.*)$", | |
"working_dir": "${file_path}", | |
"selector": "source.c, source.c++" | |
} |
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 socket | |
create_socket = lambda: socket.socket(socket.AF_INET, socket.SOCK_STREAM, socket.IPPROTO_TCP) | |
target_port = 49400 # Any port in the ephemeral port range that no process on your machine is using. | |
port = 0 | |
# Create and bind sockets, working our way through the ephemeral port space, until we get close to our target. | |
while not (target_port - 5 < port < target_port): | |
sock = create_socket() | |
sock.bind(('127.0.0.1', 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
// Because it was possible to implement std::move and std::forward<T> as library | |
// functions, so that's what happened. Now this header is everywhere. This is | |
// 2,800 lines of kitchen sink for me. | |
#include <utility> | |
// C++ has half-decent pattern matching, but only on types. If only some of this | |
// energy could be thrown at language constructs like `switch'. | |
// | |
// Oh, right, and this relies on partial specialization, which only works on | |
// classes. So you get these pointless classes that contain a single typedef. |
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 INLINED_OBJECT_H | |
#define INLINED_OBJECT_H | |
#include <string.h> | |
template <typename T, size_t Size> | |
class inlined | |
{ | |
public: | |
inlined(); |
NewerOlder