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\]" |
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
#!/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
// 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
#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
# Das tree Object zu einem commit Object erhält man z.B. mit... | |
git show commitish^{tree} |
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
# Eine einfache Ausgabe von Membern eines Objektes erreicht man mit | |
# (vorausgesetzt objekt.intMember und objekt.strMember existieren) | |
print "%(intMember)d %(strMember)s" % vars(objekt) | |
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
inline | |
CORBA::LongLong msecs_since_midnight() | |
{ | |
using namespace boost::posix_time; | |
using boost::gregorian::date; | |
using boost::numeric_cast; | |
ptime now = second_clock::local_time(); | |
time_duration td = now.time_of_day(); | |
return td.total_milliseconds(); |
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
// -*- c++ -*- | |
// compile with: "g++ -D_WIN32_WINNT=0x501 run_iosvc_in_thread.cpp -lboost_thread -lboost_system -lwsock32 -o run_iosvc_in_thread" | |
#include <boost/asio.hpp> | |
#include <boost/thread.hpp> | |
#include <boost/bind.hpp> | |
#include <boost/scoped_ptr.hpp> | |
int main() | |
{ | |
boost::scoped_ptr<boost::asio::io_service> m_ioServicePtr(new boost::asio::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
void sleepMillisec( long milliseconds ) | |
{ | |
boost::this_thread::sleep( | |
boost::get_system_time() + | |
boost::posix_time::milliseconds( std::max<long>(milliseconds,0) ) ); | |
} |
OlderNewer