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
| all:consumer producer | |
| CPPFLAGS+=-std=c++03 -Wall -pedantic | |
| CPPFLAGS+=-g -O0 | |
| CPPFLAGS+=-isystem ~/custom/boost/ | |
| LDFLAGS+=-L ~/custom/boost/stage/lib/ -Wl,-rpath,/home/sehe/custom/boost/stage/lib | |
| LDFLAGS+=-lboost_system -lrt -lpthread | |
| %:%.cpp |
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 <stdio.h> | |
| #include <sys/mman.h> | |
| #include <fcntl.h> | |
| #include <unistd.h> | |
| #include <string.h> | |
| #define STORAGE_ID "/SHM_TEST" | |
| #define STORAGE_SIZE 32 | |
| int main(int argc, char *argv[]) |
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 bitarray import bitarray | |
| import mmh3 | |
| class BloomFilter: | |
| def __init__(self, size, hash_count): | |
| self.size = size | |
| self.hash_count = hash_count | |
| self.bit_array = bitarray(size) | |
| self.bit_array.setall(0) |
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
| version: '2.1' | |
| networks: | |
| monitor-net: | |
| driver: bridge | |
| volumes: | |
| prometheus_data: {} | |
| grafana_data: {} |
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
| Source: https://tc.gts3.org/cs6265/2017/l/lab04/README-tut.txt | |
| ==================================== | |
| Lec04: Writing Exploits with PwnTool | |
| ==================================== | |
| http://docs.pwntools.com/ | |
| http://docs.pwntools.com/en/stable/intro.html |
Here's a few things I tried to write output to a python subprocess pipe.
from subprocess import Popen, PIPE
p = Popen('less', stdin=PIPE)
for x in xrange(100):
p.communicate('Line number %d.\n' % x)
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
| import subprocess | |
| import select | |
| from sys import exit | |
| p = subprocess.Popen(['python3', './subproc.py'], stdout=subprocess.PIPE) | |
| e = select.epoll() | |
| e.register(p.stdout.fileno()) | |
| while True: | |
| events = e.poll(1) |
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
| # -*- coding: utf-8 -*- | |
| """ rwlock.py | |
| A class to implement read-write locks on top of the standard threading | |
| library. | |
| This is implemented with two mutexes (threading.Lock instances) as per this | |
| wikipedia pseudocode: | |
| https://en.wikipedia.org/wiki/Readers%E2%80%93writer_lock#Using_two_mutexes |
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 | |
| """ | |
| Very simple HTTP server in python for logging requests | |
| Usage:: | |
| ./server.py [<port>] | |
| """ | |
| from http.server import BaseHTTPRequestHandler, HTTPServer | |
| import logging | |
| class S(BaseHTTPRequestHandler): |