Skip to content

Instantly share code, notes, and snippets.

@chenfengyuan
chenfengyuan / main.cpp
Created January 15, 2015 06:44
boost use callback functions in stackfull coroutine
#include <iostream>
#include <boost/asio.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/asio/spawn.hpp>
#include <memory>
void bar(boost::asio::io_service &io, std::function<void()> cb){
auto ptr = std::make_shared<boost::asio::deadline_timer>(io, boost::posix_time::seconds(1));
ptr->async_wait([ptr, cb](const boost::system::error_code&){cb();});
}
@sehe
sehe / .gitignore
Last active July 8, 2020 11:07
converting regular expressions to dot graphs (with boost spirit)
*.o
a.out
test
.*.swp
*~
*.png
tags
@devoncrouse
devoncrouse / clean_audio.sh
Created May 7, 2013 17:02
Using Sox (http://sox.sourceforge.net) to remove background noise and/or silence from audio files (individually, or in batch).
# Create background noise profile from mp3
/usr/bin/sox noise.mp3 -n noiseprof noise.prof
# Remove noise from mp3 using profile
/usr/bin/sox input.mp3 output.mp3 noisered noise.prof 0.21
# Remove silence from mp3
/usr/bin/sox input.mp3 output.mp3 silence -l 1 0.3 5% -1 2.0 5%
# Remove noise and silence in a single command
@philsquared
philsquared / C++ Extension Methods
Created April 11, 2013 23:45
How to write the "left arrow operator" to enable extension methods in C++
#include <cassert>
#include <iostream>
template<typename T, typename R=void>
struct ExtMethod {
ExtMethod& operator - () {
return *this;
}
template<typename U>