This file contains hidden or 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
from random import choices | |
# German tank problem | |
CATCH_FIRST = 1000 | |
CATCH_SECOND = 1000 | |
TRIALS = 5 | |
POPULATION = 80_000 | |
class Tank: |
This file contains hidden or 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
[CmdletBinding()] | |
param ( | |
# Where to save the Summary 'TODO.txt' file. | |
[Parameter()][String]$todoPath = '.', | |
# Which paths to search in. | |
[Parameter()][String[]]$searchPaths = @($env:HOMEDIRECTORY), | |
# What file extensions to look for (case-insensitive). No file extension is implied. | |
[Parameter()][String[]]$fileExtensions = @('txt', 'md') | |
) |
This file contains hidden or 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
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory = $false)] | |
[string] | |
$branch = 'HEAD', | |
[Parameter(Mandatory = $false)] | |
[datetime] | |
$after, | |
[Parameter(Mandatory = $false)] | |
[datetime] |
This file contains hidden or 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
with open("main.cpp", "w") as f: | |
f.write("int main()\n{\n\t\n}") | |
with open("CMakeLists.txt", "w") as f: | |
f.write("cmake_minimum_required(VERSION 3.6)\nadd_executable(app main.cpp)") | |
import os | |
os.system("cmake -S . -B ./build/") | |
path = "\""+os.getcwd()+"\\build\\Project.sln\"" | |
os.system(path) |
This file contains hidden or 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 json as table | |
from random import shuffle | |
versions = lambda i : "20"+ str(20+i//4+1) + "." + str(i%4+1) + "" | |
def deploy(number_of_versions): | |
from os.path import dirname as di, join as rel | |
for ver in number_of_versions: | |
filename = rel(di(__file__), "version-news", versions(ver)) | |
f=open(file=filename, mode="w") |
This file contains hidden or 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
# all chess notation for legal moves in fide chess | |
pieces = 'B', 'K', 'N', 'Q', 'R' | |
# pawn moves | |
for c in range(ord('a'), ord('h') + 1): | |
continue | |
caputres = ['x' + x for x in (chr(c-1), chr(c+1)) if 'a' <= x <= 'h'] | |
caputres = [''] + caputres | |
for caputre in caputres: |
This file contains hidden or 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
{"http://localhost:8000/temp_site.html": "", "http://localhost:8000/other.html": ""} |
This file contains hidden or 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
most used vim motions | |
-------------------------- | |
Help | |
:h[elp] [command] - get the help page of [command] | |
:q[uit]a[ll]! - quit Neovim without saving anything! | |
:w [file] - save current/[file] | |
:e [file] - [open]/reload file |
This file contains hidden or 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
using System.Xml; | |
using System.Xml.Linq; | |
using System.Runtime.Serialization.Json; | |
using System.Text; | |
using System.Text.RegularExpressions; | |
var restSharpJson = """ | |
{ | |
"errorResponse": | |
{ |
This file contains hidden or 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 re | |
content = """ | |
""" | |
# readfile | |
# find the matching function name "Foofuncname(" | |
def get_graph_node(loaad): | |
thing = re.findall(r"(?:\w+\s)* (\w+)\(", loaad) |
NewerOlder