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 yaml | |
import json | |
import sys | |
with open(sys.argv[1]) as f: | |
y = yaml.safe_load(f) | |
with open(sys.argv[1].replace("yml", "json").replace("yaml", "json"), "w") as ff: | |
json.dump(y, ff) |
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
# https://www.ssllabs.com/ssltest/clients.html | |
import requests | |
SUPPORTED_CIPHERS = { | |
"TLS_AES_128_GCM_SHA256", | |
"TLS_AES_256_GCM_SHA384", | |
"TLS_CHACHA20_POLY1305_SHA256", | |
"TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256", | |
"OLD_TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", |
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
from ipaddress import ip_network | |
rfc_1918 = [ip_network('10.0.0.0/8'), ip_network('172.16.0.0/12'), ip_network('192.168.0.0/16')] | |
final = [ip_network('0.0.0.0/0')] | |
for ex in rfc_1918: | |
for n in list(final): | |
try: | |
final.extend(n.address_exclude(ex)) | |
final.remove(n) |
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 csv | |
import os | |
import requests | |
EMAIL = os.getenv("CLOUDFLARE_EMAIL") | |
API_KEY = os.getenv("CLOUDFLARE_API_KEY") | |
ACCOUNT_ID = os.getenv("CLOUDFLARE_ACCOUNT_ID") | |
s = requests.Session() |
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 argparse | |
import logging | |
import typing as t | |
from elasticsearch import Elasticsearch # type: ignore | |
from tqdm.auto import tqdm # type: ignore | |
JSON = t.Union[str, int, float, bool, None, t.Dict[str, t.Any], t.List[t.Any]] |
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
# not performant, not useful for large lists | |
# cake(a: List[int]) -> int: | |
cake=lambda a,l=len,g=range:max([l(r)for r in[a[i:j+1]for i in g(l(a))for j in g(i,l(a))]if sum(r)==l(r)/2]+[0]) # 112 | |
def test_1(): | |
assert cake([]) == 0 | |
def test_2(): |
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 re as e | |
import sys as y | |
from collections import defaultdict as d | |
o,r=sorted,d(set) | |
[r["".join(o(w))].add(w)for w in e.split("\W"," ".join(y.stdin).lower())if len(w)==int(y.argv[1])] | |
[print(w+": "+",".join(o(r[w])))for w in o(r)] |
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
/** | |
* @param {string} alphabet | |
* @param {string} key | |
* @param {string} text | |
* @return {string} | |
*/ | |
f = ( |
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 re | |
curr_file = None | |
with open('structs_601_18179.cs', 'r') as s: | |
for line in s: | |
if line.startswith('}'): | |
curr_file.write(' ' + line + '}\n') | |
curr_file.close() | |
curr_file = None |
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
version: 1.0.{build} | |
configuration: | |
- Debug | |
- Release | |
platform: Any CPU | |
before_build: | |
- cmd: nuget restore | |
build: | |
verbosity: minimal | |
artifacts: |
NewerOlder