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) |
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
if [ x$INCEPTION != 'x' ]; then | |
echo "We need to go deeper..." | |
echo "This was built inside docker container" > /build/hello.txt | |
exit 0 | |
fi | |
# For storing .deb | |
VOLUME="$(docker volume create)" | |
echo "Volume is $VOLUME" |
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 <string> | |
#include <system_error> | |
#include "sqlite3.h" | |
#include "git2.h" | |
struct sqlite_error_category | |
: std::error_category | |
{ | |
const char *name() const noexcept override | |
{ |
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 <fstream> | |
#include <sstream> | |
#include <string> | |
#include <array> | |
int | |
main() | |
{ | |
std::ifstream ifs("/etc/passwd"); |