We build too many walls and not enough bridges

This commit is contained in:
Jakub
2020-04-08 12:59:16 +02:00
commit 17f4d6097a
494 changed files with 62753 additions and 0 deletions

BIN
utils/addcert.scpt Normal file

Binary file not shown.

33
utils/credits.sh Executable file
View File

@ -0,0 +1,33 @@
#!/bin/bash
## Generate credits from go.mod
# Vendor packages
LOCKFILE=../go.mod
egrep $'^\t[^=>]*$' $LOCKFILE | sed -r 's/\t([^ ]*) v.*/\1/g' > tmp1
egrep $'^\t.*=>.*v.*$' $LOCKFILE | sed -r 's/^.*=> ([^ ]*)( v.*)?/\1/g' >> tmp1
cat tmp1 | egrep -v 'therecipe/qt/internal|therecipe/env_.*_512|protontech' | sort | uniq > tmp
# Add non vendor credits
echo -e "\nFont Awesome 4.7.0\n\nQt 5.13 by Qt group\n" >> tmp
# join lines
sed -i -e ':a' -e 'N' -e '$!ba' -e 's|\n|;|g' tmp
echo '// Copyright (c) 2020 Proton Technologies AG
//
// This file is part of ProtonMail Bridge.
//
// ProtonMail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ProtonMail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
' > ../internal/bridge/credits.go
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage bridge\n\nconst Credits = "'$(cat tmp)'"' >> ../internal/bridge/credits.go
rm tmp1 tmp

52
utils/dxtn/dxtn.cbp Normal file
View File

@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_project_file>
<FileVersion major="1" minor="6" />
<Project>
<Option title="dxtn" />
<Option pch_mode="2" />
<Option compiler="gnu_gcc_compiler_default" />
<Build>
<Target title="Debug">
<Option output="bin/Debug/dxtn" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Debug/" />
<Option type="3" />
<Option compiler="gnu_gcc_compiler_default" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-g" />
</Compiler>
<Linker>
<Add library="user32" />
</Linker>
</Target>
<Target title="Release">
<Option output="bin/Release/dxtn" prefix_auto="1" extension_auto="1" />
<Option object_output="obj/Release/" />
<Option type="3" />
<Option compiler="gnu_gcc_compiler_default" />
<Option createDefFile="1" />
<Option createStaticLib="1" />
<Compiler>
<Add option="-Wall" />
<Add option="-DBUILD_DLL" />
<Add option="-O2" />
</Compiler>
<Linker>
<Add option="-s" />
<Add library="user32" />
</Linker>
</Target>
</Build>
<Unit filename="main.cpp" />
<Unit filename="main.h" />
<Extensions>
<code_completion />
<envvars />
<debugger />
<lib_finder disable_auto="1" />
</Extensions>
</Project>
</CodeBlocks_project_file>

10
utils/dxtn/dxtn.layout Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<CodeBlocks_layout_file>
<FileVersion major="1" minor="0" />
<ActiveTarget name="Release" />
<File name="main.cpp" open="1" top="1" tabpos="1" split="0" active="1" splitpos="0" zoom_1="0" zoom_2="0">
<Cursor>
<Cursor1 position="142" topLine="0" />
</Cursor>
</File>
</CodeBlocks_layout_file>

6
utils/dxtn/main.cpp Normal file
View File

@ -0,0 +1,6 @@
#include "main.h"
extern "C" DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
return FALSE;
}

12
utils/dxtn/main.h Normal file
View File

@ -0,0 +1,12 @@
#ifndef __MAIN_H__
#define __MAIN_H__
#include <windows.h>
#ifdef BUILD_DLL
#define DLL_EXPORT __declspec(dllexport)
#else
#define DLL_EXPORT __declspec(dllimport)
#endif
#endif // __MAIN_H__

21
utils/release-notes.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Generate release notes information
echo '// Copyright (c) 2020 Proton Technologies AG
//
// This file is part of ProtonMail Bridge.
//
// ProtonMail Bridge is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ProtonMail Bridge is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with ProtonMail Bridge. If not, see <https://www.gnu.org/licenses/>.
' > ../internal/bridge/release_notes.go
echo -e '// Code generated by '`echo $0`' at '`date`'. DO NOT EDIT.\n\npackage bridge\n\nconst ReleaseNotes = `'"$(cat ../release-notes/notes.txt)"'\n`\n\nconst ReleaseFixedBugs = `'"$(cat ../release-notes/bugs.txt)"'\n`' >> ../internal/bridge/release_notes.go

76
utils/sync_bench.py Normal file
View File

@ -0,0 +1,76 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# first try
data = {
"mails" : [ 500 , 1000 , 2000 , 10*1000 ] ,
"retries" : [ 1 , 1 , 1 , 1 ] ,
"time[ns]" : [ 2386939573 , 5082383333 , 9836788842 , 46028190203 ] ,
"mem[MB]" : [ 33.28 , 56.44 , 138.73 , 732.02 ] ,
"time[s]" : [ 0 , 0 , 0 , 0 ] ,
"time/mail[ms]" : [ 0 , 0 , 0 , 0 ] ,
"mem/mail[kB]" : [ 0 , 0 , 0 , 0 ] ,
}
# using Put in loop
data = {
"mails" : [ 500 , 1000 , 2000 , 10*1000 ] ,
"retries" : [ 1 , 1 , 1 , 1 ] ,
"time[ns]" : [ 2289519548 , 4469488350 , 8935239780 , 50641402322 ] ,
"mem[MB]" : [ 27.21 , 60.51 , 127.06 , 763.31 ] ,
"time[s]" : [ 0 , 0 , 0 , 0 ] ,
"time/mail[ms]" : [ 0 , 0 , 0 , 0 ] ,
"mem/mail[kB]" : [ 0 , 0 , 0 , 0 ] ,
}
# after PutMany rewrite
data = {
"mails" : [ 500 , 1000 , 2000 , 10*1000 , 50*1000 , 100*1000 ] ,
"retries" : [ 20 , 20 , 10 , 1 , 1 , 1 ] ,
"time[ns]" : [ 53334780 , 70278788 , 122645482 , 1098762327 , 7565912638 , 28189738329 ] ,
"mem[MB]" : [ 61.82 , 162.69 , 191.60 , 36.53 , 258.58 , 523.37 ] ,
"mem[MB/op]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"time[s]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"time/mail[ms]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"mem/mail[kB]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
}
# after refactor
data = {
"mails" : [ 500 , 1000 , 2000 , 10*1000 , 50*1000 , 100*1000 ] ,
"retries" : [ 20 , 20 , 10 , 1 , 1 , 1 ] ,
"time[ns]" : [ 65210959 , 84387204 , 154611276 , 1450409808 , 12866781601 , 53265480248 ] ,
"mem[MB]" : [ 0 , 0 , 0 , 0 , 60.39 , 523.37 ] ,
"mem[MB/op]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"time[s]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"time/mail[ms]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
"mem/mail[kB]" : [ 0 , 0 , 0 , 0 , 0 , 0 ] ,
}
allColumns= [ "mails", "retries" , "time[ns]" , "time[s]" , "time/mail[ms]" , "mem[MB]", "mem[MB/op]" , "mem/mail[kB]" ]
for i,n in enumerate(data["mails"]):
data["time[s]"][i] = data["time[ns]"][i] /1000/1000/1000
data["time/mail[ms]"][i] = data["time[ns]"][i] /1000/1000 /n
data["mem[MB/op]"][i] = data["mem[MB]"][i] /data["retries"][i]
data["mem/mail[kB]"][i] = data["mem[MB/op]"][i] *1024 / n
pass
print("| "+" | ".join(allColumns) + " |")
print("| :-- "*len(allColumns) + "|")
for i,n in enumerate(data["mails"]) :
val = [ str(data[col][i]) for col in allColumns ]
print("| "+" | ".join(val) + " |")