Posts


  • Setting up PIP and PyPi on Mac OS

    Setting up PIP

    Pip can be mostly used out of the box. To configure a different repository the configuration file needs to be edited.

    The configuration file should be stored in ~/Library/Application Support/pip/pip.conf according to this post. If the folder and file are not existing, simply create those and then define the extra repository as follows:

    [global]
    extra-index-url = http://download.example.com
    

    After this is done, pip install ... will also look in the extra repository for the corresponding package.

    Uploading to PyPi

    Uploading your package to PyPi is quite simple with twine.

    First, you need to package your python application as follows:

    python setup.py sdist bdist_wheel
    

    This generates a source package in the tar.gz format and a compiled wheel package. If the source code is pure Python, this package will be platform independent.

    The following step is optional and tests the upload to the PyPi test repository:

    twine upload --repository-url https://test.pypi.org/legacy/ dist/*
    

    As the next step this package needs to be uploaded which can be achieved as follows:

    twine upload dist/*
    

    That’s it. You can now see your package on PyPi.org. It is important to note that a version number cannot exist twice and cannot be updated. To do so, you have to manually delete the old version first.


  • Facebook stored millions of passwords in plaintext

    Brian Krebs

    Hundreds of millions of Facebook users had their account passwords stored in plain text and searchable by thousands of Facebook employees — in some cases going back to 2012, KrebsOnSecurity has learned. Facebook says an ongoing investigation has so far found no indication that employees have abused access to this data.

    Facebook’s statement can be found here.


  • Quick introduction to using and serving Helm Charts

    For this posting I assume that kubectl and helm are installed and working. If unsure, this can be checked via kubectl get pods --all namespaces which should return a pod with the name tiller-deploy-[...]. For these examples I am using minikube.

    To create an initial helm chart, run the command helm create <name>. This creates a new chart template with the name <name>. Of course this should be replaced with the actual name.

    How to create the actual chart will be part of another blog entry.

    To package that chart, run the following.

    $ cd mychart/
    $ helm package .
    

    A webserver for hosting Charts is the Chartmuseum. Generally every server which can serve static files will work fine although the index.yaml has to be created. The quickest way for testing is to deploy the Chartmuseum via helm itself:

    $ helm install --set env.open.DISABLE_API=false stable/chartmuseum
    

    It is important to note that DISABLE_API needs to be set to false, otherwise no uploads will be possible.

    To upload the packaged chart to Chartmuseum, type the following curl command:

    $ curl --data-binary "@mychart-0.1.0.tgz" http://localhost:8080/api/charts
    

    Alternatively, the helm-push-plugin can be used with:

    helm plugin install https://github.com/chartmuseum/helm-push
    

    To use the chart in helm, the repository has to be registered with helm:

    $ helm repo add chartmuseum http://localhost:8080
    

    And then the chart can be pushed via:

    $ helm push mychart/ chartmuseum
    

    More information can be found in the Chartmuseum documentation. Lastly, this guide provides step-by-step information for using a helm chart repository.

    To test the newly uploaded chart the repositories need to be updated first with:

    $ helm repo update
    Hang tight while we grab the latest from your chart repositories...
    ...Skip local chart repository
    ...Successfully got an update from the "chartmuseum" chart repository
    ...Successfully got an update from the "stable" chart repository
    Update Complete. ⎈ Happy Helming!⎈
    

    Note: At the time of writing, helm does not automatically update the charts before installing and thus it is required to update before a search can occur. This feature is proposed for Helm 3.

    To show all charts of the helm simply run:

    $ helm search chartmuseum/
    

    You should now see your newly created chart.


  • febase62 v1.1.0 now available

    I just released version 1.1.0 of febase62. With this update it is now possible to encode byte strings as base62. The method signature stays the same:

    >>> from febase62.base62 import Base62
    >>> encoder = Base62()
    >>> encoder.encode(b'\aa')
    '6Sd'
    

    The old way still works:

    >>> from febase62.base62 import Base62
    >>> encoder = Base62()
    >>> encoder.encode(1337)
    'LZ'
    

    The package can be installed via pip install febase62 and the source code can be found here.


  • Creating UUID under Mac OS Shell

    I have the following alias in my .bashrc to create UUID’s quickly from the shell:

    alias uuid="uuidgen | tr -d - | tr -d '\n' | tr '[:upper:]' '[:lower:]' | pbcopy && pbpaste && echo"
    

    This generates a lowercase uuid and copies it to the clipboard all by calling uuid.



Page: 2 of 9 subscribe via RSS