This file contains 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 <boost/interprocess/streams/vectorstream.hpp> | |
#include <vector> | |
#include <string> | |
typedef std::vector<char> CharVec; | |
typedef boost::interprocess::basic_vectorstream<CharVec> vectorstream; | |
typedef boost::interprocess::basic_ivectorstream<CharVec> ivectorstream; | |
typedef boost::interprocess::basic_ovectorstream<CharVec> ovectorstream; | |
int main() |
This file contains 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
// Fixed example from: http://thisthread.blogspot.com/2011/04/multithreading-with-asio.html | |
void run (int tNumber) // 1. | |
{ | |
boost::asio::io_service svc; // 2. | |
boost::thread_group threads; | |
{ | |
std::auto_ptr<boost::asio::io_service::work> work(new boost::asio::io_service::work(svc)); //3. | |
for (int i = 0; i < tNumber; ++i) // 4. |
This file contains 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
#!/bin/bash | |
#hashapass.com method for generating passwords | |
#script by Simon Elmir | |
export IFS="" #read will now preserve whitespace | |
read -rp "parameter: " PARAMETER | |
read -rsp "password: " PASSWORD | |
echo | |
echo -n "$PARAMETER" \ | |
| openssl dgst -sha1 -binary -hmac "$PASSWORD" \ | |
| openssl enc -base64 \ |
This file contains 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
void set_result(optional<error_code>* a, error_code b) | |
{ | |
a->reset(b); | |
} | |
template <typename MutableBufferSequence> | |
void read_with_timeout(tcp::socket& sock, | |
const MutableBufferSequence& buffers) | |
{ | |
optional<error_code> timer_result; | |
deadline_timer timer(sock.io_service()); |
This file contains 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
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
BLUE="\[\033[0;34m\]" | |
LIGHT_RED="\[\033[1;31m\]" | |
LIGHT_GREEN="\[\033[1;32m\]" | |
WHITE="\[\033[1;37m\]" | |
LIGHT_GRAY="\[\033[0;37m\]" | |
COLOR_NONE="\[\e[0m\]" |
NewerOlder