diff --git a/AutoCert/README.md b/AutoCert/README.md new file mode 100644 index 00000000..e1924307 --- /dev/null +++ b/AutoCert/README.md @@ -0,0 +1,27 @@ +This repository consists of a list of python scripts to automate few tasks. + +You can contribute by adding more python scripts which can be used to automate things. Some of already done are listed below. +Incase you have anything to be followed while executing the python script mention it as well + + +# Python Script + +## Script - AutoCert + +A Python script to auto generate e-certificates in bulk. + +# Instruction to use +
    +
  1. First install all the dependencies, present in the requirements.txt file
  2. +
  3. Put a certificate template with blank fields, in the project folder, with the name `certificateTemplate.png` .Make sure the template is in `png` format only
  4. +
  5. Put the input `csv` file containing a list of the participant names by under a column name.
  6. +
  7. Once all this is done, run `python3 main.py` in your terminal
  8. +
  9. The generated certificates would be present under the *export* folder, with each certificate having the name of the participant.
  10. +
+ +# Optional +- One can change the font, by adding custom fonts under the font folder. +- One can change the location of the name inside the main.py file. + + + diff --git a/AutoCert/Sample.png b/AutoCert/Sample.png new file mode 100644 index 00000000..db93ae2f Binary files /dev/null and b/AutoCert/Sample.png differ diff --git a/AutoCert/exports/rahul.pdf b/AutoCert/exports/rahul.pdf new file mode 100644 index 00000000..8a534258 Binary files /dev/null and b/AutoCert/exports/rahul.pdf differ diff --git a/AutoCert/fonts/Roboto-Light.ttf b/AutoCert/fonts/Roboto-Light.ttf new file mode 100644 index 00000000..0e977514 Binary files /dev/null and b/AutoCert/fonts/Roboto-Light.ttf differ diff --git a/AutoCert/fonts/Roboto-Thin.ttf b/AutoCert/fonts/Roboto-Thin.ttf new file mode 100644 index 00000000..7d084aed Binary files /dev/null and b/AutoCert/fonts/Roboto-Thin.ttf differ diff --git a/AutoCert/fonts/orbitron-black.otf b/AutoCert/fonts/orbitron-black.otf new file mode 100644 index 00000000..7fc1e44f Binary files /dev/null and b/AutoCert/fonts/orbitron-black.otf differ diff --git a/AutoCert/main.py b/AutoCert/main.py new file mode 100644 index 00000000..3ef2d184 --- /dev/null +++ b/AutoCert/main.py @@ -0,0 +1,45 @@ +from PIL import Image, ImageFont, ImageDraw +import pandas as pd +import os + + +def generator(name_list, name_font, name_size, name_loc, id_font, id_size, id_loc, event_id, id_offset=0): + name_font = ImageFont.truetype(name_font, size=name_size) + id_font = ImageFont.truetype(id_font, size=id_size) + + for i in range(0, len(name_list)): + im = Image.open("Sample.png") + sample = ImageDraw.Draw(im) + text_color = (63, 61, 86) + + name = name_list[i] + w, h = sample.textsize(name, font=name_font) + W, H = name_loc + sample.text((W - w / 2, H - h / 2), name, font=name_font, fill=text_color) + + cert_id = event_id + str(i + 1) + W, H = id_loc + sample.text((W, H), cert_id, font=id_font, fill=text_color) + + rgb = Image.new('RGB', im.size, (255, 255, 255)) + rgb.paste(im, mask=im.split()[3]) + rgb.save('exports/' + name + '.pdf', 'PDF', resoultion=100.0) + + +def process(): + data = pd.read_csv('names.csv', names=['names']) + evnetID = input("Enter the event name") + generator( + data.names.tolist(), + "fonts/Roboto-Light.ttf", + 60, + (1260.5, 811.5), + "fonts/orbitron-black.otf", + 48, + (1326, 1369), + evnetID, + 0 + ) + + +process() diff --git a/AutoCert/names.csv b/AutoCert/names.csv new file mode 100644 index 00000000..fdd75f1a --- /dev/null +++ b/AutoCert/names.csv @@ -0,0 +1 @@ +vaibhav,rahul diff --git a/AutoCert/requirements.txt b/AutoCert/requirements.txt new file mode 100644 index 00000000..5797c844 --- /dev/null +++ b/AutoCert/requirements.txt @@ -0,0 +1,298 @@ +alabaster @ file:///home/ktietz/src/ci/alabaster_1611921544520/work +anaconda-client==1.7.2 +anaconda-navigator==2.0.3 +anaconda-project @ file:///tmp/build/80754af9/anaconda-project_1610472525955/work +anyio @ file:///tmp/build/80754af9/anyio_1617783275907/work/dist +appdirs==1.4.4 +argh==0.26.2 +argon2-cffi @ file:///tmp/build/80754af9/argon2-cffi_1613037097816/work +asn1crypto @ file:///tmp/build/80754af9/asn1crypto_1596577642040/work +astroid @ file:///tmp/build/80754af9/astroid_1613500854201/work +astropy @ file:///tmp/build/80754af9/astropy_1617745353437/work +async-generator @ file:///home/ktietz/src/ci/async_generator_1611927993394/work +atomicwrites==1.4.0 +attrs @ file:///tmp/build/80754af9/attrs_1604765588209/work +autopep8 @ file:///tmp/build/80754af9/autopep8_1615918855173/work +Babel @ file:///tmp/build/80754af9/babel_1607110387436/work +backcall @ file:///home/ktietz/src/ci/backcall_1611930011877/work +backports.functools-lru-cache @ file:///tmp/build/80754af9/backports.functools_lru_cache_1618170165463/work +backports.shutil-get-terminal-size @ file:///tmp/build/80754af9/backports.shutil_get_terminal_size_1608222128777/work +backports.tempfile @ file:///home/linux1/recipes/ci/backports.tempfile_1610991236607/work +backports.weakref==1.0.post1 +beautifulsoup4 @ file:///home/linux1/recipes/ci/beautifulsoup4_1610988766420/work +bitarray @ file:///tmp/build/80754af9/bitarray_1620827551536/work +bkcharts==0.2 +black==19.10b0 +bleach @ file:///tmp/build/80754af9/bleach_1612211392645/work +bokeh @ file:///tmp/build/80754af9/bokeh_1620779595936/work +boto==2.49.0 +Bottleneck==1.3.2 +brotlipy==0.7.0 +cachetools==4.2.1 +certifi==2020.12.5 +cffi @ file:///tmp/build/80754af9/cffi_1613246945912/work +chardet @ file:///tmp/build/80754af9/chardet_1607706746162/work +click @ file:///home/linux1/recipes/ci/click_1610990599742/work +cloudpickle @ file:///tmp/build/80754af9/cloudpickle_1598884132938/work +clyent==1.2.2 +colorama @ file:///tmp/build/80754af9/colorama_1607707115595/work +conda==4.10.1 +conda-build==3.21.4 +conda-content-trust @ file:///tmp/build/80754af9/conda-content-trust_1617045594566/work +conda-package-handling @ file:///tmp/build/80754af9/conda-package-handling_1618262148928/work +conda-repo-cli @ file:///tmp/build/80754af9/conda-repo-cli_1620168426516/work +conda-token @ file:///tmp/build/80754af9/conda-token_1620076980546/work +conda-verify==3.4.2 +contextlib2==0.6.0.post1 +crc32c==2.2 +cryptography==3.3.2 +cycler==0.10.0 +Cython==0.29.22 +cytoolz==0.11.0 +dask @ file:///tmp/build/80754af9/dask-core_1617390489108/work +decorator @ file:///tmp/build/80754af9/decorator_1617916966915/work +defusedxml @ file:///tmp/build/80754af9/defusedxml_1615228127516/work +diff-match-patch @ file:///tmp/build/80754af9/diff-match-patch_1594828741838/work +dill==0.3.3 +distributed @ file:///tmp/build/80754af9/distributed_1620902833129/work +dlx==1.0.4 +docplex==2.15.194 +docutils @ file:///tmp/build/80754af9/docutils_1620827984873/work +entrypoints==0.3 +et-xmlfile==1.0.1 +fastcache==1.1.0 +fastdtw==0.3.4 +fastjsonschema==2.15.0 +filelock @ file:///home/linux1/recipes/ci/filelock_1610993975404/work +flake8 @ file:///tmp/build/80754af9/flake8_1615834841867/work +Flask @ file:///home/ktietz/src/ci/flask_1611932660458/work +fsspec @ file:///tmp/build/80754af9/fsspec_1617959894824/work +func-timeout==4.3.5 +future==0.18.2 +ga==0.1.1.dev0 +geneticalgorithm==1.0.2 +gevent @ file:///tmp/build/80754af9/gevent_1616770671827/work +glob2 @ file:///home/linux1/recipes/ci/glob2_1610991677669/work +gmpy2==2.0.8 +google-api-core==1.26.0 +google-api-python-client==1.12.8 +google-auth==1.27.0 +google-auth-httplib2==0.0.4 +google-auth-oauthlib==0.4.2 +googleapis-common-protos==1.53.0 +greenlet @ file:///tmp/build/80754af9/greenlet_1611957705398/work +gs==1.0.0 +h5py==3.2.1 +HeapDict==1.0.1 +html5lib @ file:///tmp/build/80754af9/html5lib_1593446221756/work +httplib2==0.19.0 +idna @ file:///home/linux1/recipes/ci/idna_1610986105248/work +imageio @ file:///tmp/build/80754af9/imageio_1617700267927/work +imagesize @ file:///home/ktietz/src/ci/imagesize_1611921604382/work +importlib-metadata @ file:///tmp/build/80754af9/importlib-metadata_1617874469820/work +inflection==0.5.1 +iniconfig @ file:///home/linux1/recipes/ci/iniconfig_1610983019677/work +intervaltree @ file:///tmp/build/80754af9/intervaltree_1598376443606/work +ipykernel @ file:///tmp/build/80754af9/ipykernel_1596207638929/work/dist/ipykernel-5.3.4-py3-none-any.whl +ipython @ file:///tmp/build/80754af9/ipython_1617120885885/work +ipython-genutils @ file:///tmp/build/80754af9/ipython_genutils_1606773439826/work +ipywidgets @ file:///tmp/build/80754af9/ipywidgets_1610481889018/work +isort @ file:///tmp/build/80754af9/isort_1616355431277/work +itsdangerous @ file:///home/ktietz/src/ci/itsdangerous_1611932585308/work +jdcal==1.4.1 +jedi @ file:///tmp/build/80754af9/jedi_1606932564285/work +jeepney @ file:///tmp/build/80754af9/jeepney_1606148855031/work +Jinja2 @ file:///tmp/build/80754af9/jinja2_1612213139570/work +joblib==1.2.0 +json5==0.9.5 +jsonschema @ file:///tmp/build/80754af9/jsonschema_1602607155483/work +jupyter==1.0.0 +jupyter-client @ file:///tmp/build/80754af9/jupyter_client_1616770841739/work +jupyter-console @ file:///tmp/build/80754af9/jupyter_console_1616615302928/work +jupyter-core @ file:///tmp/build/80754af9/jupyter_core_1612213311222/work +jupyter-packaging @ file:///tmp/build/80754af9/jupyter-packaging_1613502826984/work +jupyter-server @ file:///tmp/build/80754af9/jupyter_server_1616083640759/work +jupyterlab @ file:///tmp/build/80754af9/jupyterlab_1619133235951/work +jupyterlab-pygments @ file:///tmp/build/80754af9/jupyterlab_pygments_1601490720602/work +jupyterlab-server @ file:///tmp/build/80754af9/jupyterlab_server_1617134334258/work +jupyterlab-widgets @ file:///tmp/build/80754af9/jupyterlab_widgets_1609884341231/work +keyring @ file:///tmp/build/80754af9/keyring_1614616740399/work +kiwisolver==1.3.1 +lazy-object-proxy @ file:///tmp/build/80754af9/lazy-object-proxy_1616526917483/work +libarchive-c @ file:///tmp/build/80754af9/python-libarchive-c_1617780486945/work +llvmlite==0.36.0 +locket==0.2.1 +lxml==4.9.1 +MarkupSafe==1.1.1 +matplotlib==3.3.3 +mccabe==0.6.1 +mistune==0.8.4 +mkl-fft==1.3.0 +mkl-random @ file:///tmp/build/80754af9/mkl_random_1618853849286/work +mkl-service==2.3.0 +mock @ file:///tmp/build/80754af9/mock_1607622725907/work +more-itertools @ file:///tmp/build/80754af9/more-itertools_1613676688952/work +mpmath==1.1.0 +msgpack @ file:///tmp/build/80754af9/msgpack-python_1612287151062/work +multipledispatch==0.6.0 +multitasking==0.0.9 +mypy-extensions==0.4.3 +navigator-updater==0.2.1 +nbclassic @ file:///tmp/build/80754af9/nbclassic_1616085367084/work +nbclient @ file:///tmp/build/80754af9/nbclient_1614364831625/work +nbconvert @ file:///tmp/build/80754af9/nbconvert_1601914830498/work +nbformat @ file:///tmp/build/80754af9/nbformat_1617383369282/work +nest-asyncio==1.5.1 +networkx==2.5 +nltk @ file:///tmp/build/80754af9/nltk_1618327084230/work +nose==1.3.7 +notebook @ file:///tmp/build/80754af9/notebook_1616443462982/work +ntlm-auth==1.5.0 +numba @ file:///tmp/build/80754af9/numba_1616774046117/work +numexpr @ file:///tmp/build/80754af9/numexpr_1618856167419/work +numpy==1.22.0 +numpydoc @ file:///tmp/build/80754af9/numpydoc_1605117425582/work +oauth2client==4.1.3 +olefile==0.46 +openpyxl @ file:///tmp/build/80754af9/openpyxl_1615411699337/work +packaging==20.9 +pandas==1.2.0 +pandocfilters @ file:///tmp/build/80754af9/pandocfilters_1605120460739/work +parso==0.7.0 +partd @ file:///tmp/build/80754af9/partd_1618000087440/work +path @ file:///tmp/build/80754af9/path_1614022220526/work +pathlib2 @ file:///tmp/build/80754af9/pathlib2_1607024983162/work +pathspec==0.7.0 +patsy==0.5.1 +pep8==1.7.1 +pexpect @ file:///tmp/build/80754af9/pexpect_1605563209008/work +pickleshare @ file:///tmp/build/80754af9/pickleshare_1606932040724/work +Pillow @ file:///tmp/build/80754af9/pillow_1617383569452/work +pkginfo==1.7.0 +pluggy @ file:///tmp/build/80754af9/pluggy_1615976321666/work +ply==3.11 +prometheus-client @ file:///tmp/build/80754af9/prometheus_client_1618088486455/work +prompt-toolkit @ file:///tmp/build/80754af9/prompt-toolkit_1616415428029/work +protobuf==3.18.3 +psutil==5.8.0 +ptyprocess @ file:///tmp/build/80754af9/ptyprocess_1609355006118/work/dist/ptyprocess-0.7.0-py2.py3-none-any.whl +py @ file:///tmp/build/80754af9/py_1607971587848/work +pyasn1==0.4.8 +pyasn1-modules==0.2.8 +pybind11==2.6.2 +pycodestyle @ file:///home/ktietz/src/ci_mi/pycodestyle_1612807597675/work +pycosat==0.6.3 +pycparser @ file:///tmp/build/80754af9/pycparser_1594388511720/work +pycurl==7.43.0.6 +pydocstyle @ file:///tmp/build/80754af9/pydocstyle_1616182067796/work +pyerfa @ file:///tmp/build/80754af9/pyerfa_1619390903914/work +pyflakes @ file:///home/ktietz/src/ci_ipy2/pyflakes_1612551159640/work +Pygments @ file:///tmp/build/80754af9/pygments_1615143339740/work +PyJWT==2.4.0 +pylint @ file:///tmp/build/80754af9/pylint_1617135829881/work +pyls-black @ file:///tmp/build/80754af9/pyls-black_1607553132291/work +pyls-spyder @ file:///tmp/build/80754af9/pyls-spyder_1613849700860/work +pyodbc===4.0.0-unsupported +pyOpenSSL @ file:///tmp/build/80754af9/pyopenssl_1608057966937/work +pyparsing==2.4.7 +pyrsistent @ file:///tmp/build/80754af9/pyrsistent_1600141720057/work +PySocks @ file:///tmp/build/80754af9/pysocks_1605305779399/work +pytest==6.2.3 +python-constraint==1.4.0 +python-dateutil==2.8.1 +python-jsonrpc-server @ file:///tmp/build/80754af9/python-jsonrpc-server_1600278539111/work +python-language-server @ file:///tmp/build/80754af9/python-language-server_1607972495879/work +pytz @ file:///tmp/build/80754af9/pytz_1612215392582/work +PyWavelets @ file:///tmp/build/80754af9/pywavelets_1601658317819/work +pyxdg @ file:///tmp/build/80754af9/pyxdg_1603822279816/work +PyYAML==5.4.1 +pyzmq==20.0.0 +QDarkStyle==2.8.1 +qiskit==0.24.0 +qiskit-aer==0.7.6 +qiskit-aqua==0.8.2 +qiskit-ibmq-provider==0.12.1 +qiskit-ignis==0.5.2 +qiskit-terra==0.16.4 +QtAwesome @ file:///tmp/build/80754af9/qtawesome_1615991616277/work +qtconsole @ file:///tmp/build/80754af9/qtconsole_1616775094278/work +QtPy==1.9.0 +Quandl==3.6.1 +regex @ file:///tmp/build/80754af9/regex_1617569202463/work +requests @ file:///tmp/build/80754af9/requests_1608241421344/work +requests-ntlm==1.1.0 +requests-oauthlib==1.3.0 +retworkx==0.8.0 +rope @ file:///tmp/build/80754af9/rope_1602264064449/work +rsa==4.7.2 +Rtree @ file:///tmp/build/80754af9/rtree_1618420845272/work +ruamel-yaml-conda @ file:///tmp/build/80754af9/ruamel_yaml_1616016699510/work +scikit-image==0.18.1 +scikit-learn==0.24.0 +scipy==1.6.0 +seaborn @ file:///tmp/build/80754af9/seaborn_1608578541026/work +SecretStorage @ file:///tmp/build/80754af9/secretstorage_1614022784285/work +selenium==3.141.0 +Send2Trash @ file:///tmp/build/80754af9/send2trash_1607525499227/work +simplegeneric==0.8.1 +singledispatch @ file:///tmp/build/80754af9/singledispatch_1614366001199/work +sip==4.19.13 +six @ file:///tmp/build/80754af9/six_1605205327372/work +sklearn==0.0 +sniffio @ file:///tmp/build/80754af9/sniffio_1614030475067/work +snowballstemmer @ file:///tmp/build/80754af9/snowballstemmer_1611258885636/work +sortedcollections @ file:///tmp/build/80754af9/sortedcollections_1611172717284/work +sortedcontainers @ file:///tmp/build/80754af9/sortedcontainers_1606865132123/work +soupsieve @ file:///tmp/build/80754af9/soupsieve_1616183228191/work +Sphinx @ file:///tmp/build/80754af9/sphinx_1620777493457/work +sphinxcontrib-applehelp @ file:///home/ktietz/src/ci/sphinxcontrib-applehelp_1611920841464/work +sphinxcontrib-devhelp @ file:///home/ktietz/src/ci/sphinxcontrib-devhelp_1611920923094/work +sphinxcontrib-htmlhelp @ file:///home/ktietz/src/ci/sphinxcontrib-htmlhelp_1611920974801/work +sphinxcontrib-jsmath @ file:///home/ktietz/src/ci/sphinxcontrib-jsmath_1611920942228/work +sphinxcontrib-qthelp @ file:///home/ktietz/src/ci/sphinxcontrib-qthelp_1611921055322/work +sphinxcontrib-serializinghtml @ file:///home/ktietz/src/ci/sphinxcontrib-serializinghtml_1611920755253/work +sphinxcontrib-websupport @ file:///tmp/build/80754af9/sphinxcontrib-websupport_1597081412696/work +spyder @ file:///tmp/build/80754af9/spyder_1616775618138/work +spyder-kernels @ file:///tmp/build/80754af9/spyder-kernels_1614030590686/work +SQLAlchemy @ file:///tmp/build/80754af9/sqlalchemy_1620712430742/work +statsmodels @ file:///tmp/build/80754af9/statsmodels_1614023746358/work +sympy==1.7.1 +tables==3.6.1 +tblib @ file:///tmp/build/80754af9/tblib_1597928476713/work +terminado==0.9.4 +testpath @ file:///home/ktietz/src/ci/testpath_1611930608132/work +textdistance @ file:///tmp/build/80754af9/textdistance_1612461398012/work +threadpoolctl==2.1.0 +three-merge @ file:///tmp/build/80754af9/three-merge_1607553261110/work +tifffile==2020.10.1 +toml @ file:///tmp/build/80754af9/toml_1616166611790/work +toolz @ file:///home/linux1/recipes/ci/toolz_1610987900194/work +tornado @ file:///tmp/build/80754af9/tornado_1606942300299/work +tqdm @ file:///tmp/build/80754af9/tqdm_1615925068909/work +traitlets @ file:///home/ktietz/src/ci/traitlets_1611929699868/work +tweak==1.0.3 +typed-ast @ file:///tmp/build/80754af9/typed-ast_1610484547928/work +typing-extensions @ file:///home/ktietz/src/ci_mi/typing_extensions_1612808209620/work +ujson @ file:///tmp/build/80754af9/ujson_1611259522456/work +unicodecsv==0.14.1 +uritemplate==3.0.1 +urllib3 @ file:///tmp/build/80754af9/urllib3_1615837158687/work +watchdog @ file:///tmp/build/80754af9/watchdog_1612471027849/work +wcwidth @ file:///tmp/build/80754af9/wcwidth_1593447189090/work +webencodings==0.5.1 +websockets==9.1 +Werkzeug @ file:///home/ktietz/src/ci/werkzeug_1611932622770/work +widgetsnbextension==3.5.1 +wrapt==1.12.1 +wurlitzer @ file:///tmp/build/80754af9/wurlitzer_1617224664226/work +xgboost==1.5.0.dev0 +xlrd==2.0.1 +XlsxWriter @ file:///tmp/build/80754af9/xlsxwriter_1617224712951/work +xlwt==1.3.0 +xmltodict==0.12.0 +yapf @ file:///tmp/build/80754af9/yapf_1615749224965/work +yfinance==0.1.55 +zict==2.0.0 +zipp @ file:///tmp/build/80754af9/zipp_1615904174917/work +zope.event==4.5.0 +zope.interface @ file:///tmp/build/80754af9/zope.interface_1616357211867/work diff --git a/README.md b/README.md index fb56573d..dbdeb1e1 100644 --- a/README.md +++ b/README.md @@ -64,4 +64,7 @@ calculate compound interest ## Script 14 - Mouse mover Moves your mouse every 15 seconds ## Script 15 - JSON to YAML converter -Converts JSON file to YAML files. A sample JSON is included for testing. \ No newline at end of file +Converts JSON file to YAML files. A sample JSON is included for testing. + +## Script 16 - AutoCert +A Python script to auto generate e-certificates in bulk. \ No newline at end of file