This file contains hidden or 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
| #include <iostream> | |
| #include "json.hpp" | |
| #include "autoprop.hpp" | |
| using namespace mpapierski; | |
| using json = nlohmann::json; | |
| class Person : public AutoProp<Person> { | |
| public: | |
| AUTOPROP_BEGIN(Person); |
This file contains hidden or 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
| @contextmanager | |
| def convert_to_pdf(filename): | |
| """Creates a PDF document based on input filename. | |
| Returns a path to PDF file | |
| """ | |
| client = docker.from_env() | |
| source = os.path.join('/tmp/{}'.format(os.path.basename(filename))) |
This file contains hidden or 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
| #!/usr/bin/env python3 | |
| from collections.abc import Iterable | |
| data = [1,2,[3,4,[5,6,[7,8,[9,10,[[[11],12],[13,14,15]]]]]]] | |
| def flatten(data): | |
| for value in data: | |
| if isinstance(value, (Iterable,)): | |
| # Call recursively to yield nested values from | |
| yield from flatten(value) |
This file contains hidden or 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
| class TestView(LoginRequiredMixin, UserPassesTestMixin, View): | |
| model = Foo | |
| def make_dataset(self): | |
| """This method returns an instance of tablib.Dataset.""" | |
| pass | |
| def get(self, request, **kwargs): | |
| # Create empty dataset | |
| dataset = self.make_dataset() |
This file contains hidden or 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
| class FooManager(models.Manager): | |
| """A manager for foos with custom filter. | |
| Adds a clause to default query to ignore removed entries. | |
| """ | |
| def get_queryset(self): | |
| """Filter out all removed entries by default.""" | |
| return super().get_queryset().filter(removed_at__isnull=True) |
This file contains hidden or 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
| #!/usr/bin/env python | |
| import socket | |
| import threading | |
| TCP_IP = '::1' | |
| TCP_PORT = 6872 | |
| BUFFER_SIZE = 20 | |
| s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM) |
This file contains hidden or 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
| tell application "Notes" | |
| set theMessages to every note | |
| repeat with thisMessage in theMessages | |
| set myTitle to the name of thisMessage | |
| set myText to the body of thisMessage | |
This file contains hidden or 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 haskell:8 | |
| RUN mkdir -p /src | |
| RUN cd /src && git clone https://github.com/kawu/concraft-pl | |
| WORKDIR /src/concraft-pl | |
| RUN stack setup | |
| RUN stack install | |
| ENTRYPOINT ["/root/.local/bin/concraft-pl"] |
This file contains hidden or 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
| s/ON_BN_CLICKED/EVT_BUTTON/g | |
| s/AfxGetApp()/::wxGetApp()/g | |
| s/CObject/wxObject/g | |
| s/CRect/wxRect/g | |
| s/CSize/wxSize/g | |
| s/CDC/wxDC/g | |
| s/CPoint/wxPoint/g | |
| s/CFont/wxFont/g | |
| s/CPen/wxPen/g |
This file contains hidden or 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
| script = '''#!/bin/sh | |
| tail -c{} $0|gunzip | |
| exit | |
| ''' | |
| with open('pwning2017.sh', 'wb') as fout: | |
| with open('payload', 'rb') as fin: | |
| payload = fin.read() | |
| fout.write(script.format(len(payload))) | |
| fout.write(payload) |