Skip to content

Instantly share code, notes, and snippets.

@sehe
sehe / clean_audio.sh
Created February 1, 2017 19:31 — forked from devoncrouse/clean_audio.sh
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
@sehe
sehe / main.cpp
Created November 22, 2016 21:50 — forked from chenfengyuan/main.cpp
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();});
}
#include "AbstractPoint.h"
#include <boost/serialization/export.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
BOOST_CLASS_EXPORT_IMPLEMENT(AbstractPoint)
/* CallgrindParser
Copyright (C) 2013 BlackBerry.
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
#include <string>
#include <iostream>
namespace dessert {
template <typename Tag>
struct not_quite_the_same_traits : std::char_traits<char> {};
template <typename Tag>
using strong_string_alias = std::basic_string<char, not_quite_the_same_traits<Tag>>;
using vanilla_string = std::string;
@sehe
sehe / gist:4994490
Last active December 13, 2015 23:49
private T ParseOneOf<T>(params Func<T>[] fs) {
var oldLexer = Lexer.Clone();
foreach (var f in fs) {
try {
return f();
} catch (SyntaxErrorException) {
Lexer = oldLexer;
}
}
throw new SyntaxErrorException();
@sehe
sehe / SetJekyllPostSyntax.vim
Last active December 13, 2015 19:59 — forked from rmartinho/SetJekyllPostSyntax.vim
SetJekyllPostSyntax
" Sets up multi-language syntax for Jekyll blog posts
fun! SetJekyllPostSyntax()
" Bring in YAML syntax for front matter
unlet b:current_syntax
syntax include @Yaml syntax/yaml.vim
syntax region yamlFrontmatter start=/\%^---$/ end=/^---$/ keepend contains=@Yaml
" Bring in C++11 syntax for code snippets
unlet b:current_syntax
syntax include @Cpp syntax/cpp11.vim
#include <type_info>
#include <memory>
#include <string>
#include <stdexcept>
class bad_mangled_name : public std::runtime_error {
public:
bad_mangled_name() : std::runtime_error{"bad name"} {}
};
@sehe
sehe / server.c
Created July 25, 2012 01:19 — forked from minitech/server.c
My prototype webserver-thing
#include "xeric-utils.h"
/* The main method. */
int main(int argc, char * argv[]) {
int i;
int port = 80;
struct in_addr address = {0};
/* Parse the arguments: */
for(i = 1; i < argc; i++) {
@sehe
sehe / Makefile
Created March 21, 2012 20:22 — forked from klmr/mini.cpp
Ambiguous function call grammar
all:mini alternative
CPPFLAGS+=-std=c++0x
CPPFLAGS+=-g -O0
%.o:%.cpp
g++ $(CPPFLAGS) $^ -o $@ $(LDFLAGS)