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 golang:1.22.2-alpine AS build | |
ARG XCADDY_VERSION=0.4.0 | |
ARG CADDY_VERSION | |
RUN apk --no-cache add libcap | |
RUN wget -O /tmp/xcaddy.tar.gz "https://github.com/caddyserver/xcaddy/releases/download/v${XCADDY_VERSION}/xcaddy_${XCADDY_VERSION}_linux_amd64.tar.gz"; \ | |
echo "$checksum /tmp/xcaddy.tar.gz" | sha512sum -c; \ | |
tar x -z -f /tmp/xcaddy.tar.gz -C /usr/bin xcaddy; \ | |
rm -f /tmp/xcaddy.tar.gz; \ | |
chmod +x /usr/bin/xcaddy; | |
RUN xcaddy build ${CADDY_VERSION} |
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 json | |
import logging | |
import time | |
logger = logging.getLogger() | |
d = {"A": 1, "B": 2, "C": {'a': 'hello', "_": 'world'}} | |
class LazyDictStr: | |
"Converts dictionary to formatted JSON string when str(...) called" |
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 json2html import json2html | |
import json | |
from markdown import markdown | |
filename = "gl-sast-report" | |
svr = {"Critical": "Crimson", "Medium": "Coral", "Low": "MediumSeaGreen", "Info": "SteelBlue"} | |
with open(filename + ".json") as f: | |
inp = json.load(f) | |
data = inp["vulnerabilities"] |
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 numpy as np | |
class NeuralNetwork(): | |
def __init__(self): | |
# seeding for random number generation | |
np.random.seed(1) | |
#converting weights to a 3 by 1 matrix with values from -1 to 1 and mean of 0 | |
self.synaptic_weights = 2 * np.random.random((3, 1)) - 1 |
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
# Self-elevate the script if required | |
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { | |
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { | |
# $CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments | |
# Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine | |
Start powershell.exe -Verb RunAs -ArgumentList "cd $pwd; & $($MyInvocation.MyCommand.Path)" | |
Exit | |
} | |
} |
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
ROOT=~/venv | |
RED='\e[0;31m' | |
GREEN='\e[0;32m' | |
LIGHTBLUE='\e[1;34m' | |
NC='\e[0m' # No Color | |
trim() { | |
# Remove the leading and trailing whitespaces | |
# https://stackoverflow.com/a/12973694 | |
echo $1 | xargs |
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
3.9.13 | |
3.10.9 | |
3.8.10 |
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 os | |
def Main(): | |
x = os.getpid() | |
print(f"{x=}") | |
if __name__ == '__main__': | |
Main() |
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 typer | |
def main( | |
hello: int = typer.Option(None), | |
there: int = typer.Option(None), | |
infinite: bool = typer.Option(False), | |
) -> None: | |
print(hello, there, infinite) | |
if __name__=='__main__': |
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
Sub tableSplitWithHeaders() | |
'https://stackoverflow.com/questions/8668311/current-row-in-vba-word | |
'https://www.tek-tips.com/viewthread.cfm?qid=1610014 | |
'https://stackoverflow.com/questions/37999841/how-can-i-determine-the-page-number-of-a-table-in-ms-word-macro | |
'https://learn.microsoft.com/en-us/office/vba/api/word.selection.insertbreak | |
Const TITLE_CONTINUE As String = "Продолжение таблицы" | |
Const TITLE_END As String = "Окончание таблицы" | |
Dim t As Table, t2 As Table, r As row |
NewerOlder