Skip to content

Instantly share code, notes, and snippets.

package main
import "runtime";
import "http";
import "io";
func HelloServer(c *http.Conn, req *http.Request) {
io.WriteString(c, "hello, world!\n");
}
#include <stdlib.h>
#include <stdio.h>
#include <event.h>
#include <evhttp.h>
static void getindex(struct evhttp_request *req, void *arg)
{
struct evbuffer *buf = evbuffer_new();
size_t len;
@dimavs
dimavs / reverse.c
Created May 3, 2011 09:24
reverse string and replace '\' symbols with '/'
#include <stdio.h>
#include <string.h>
unsigned int reverse_and_replace(unsigned char* str)
{
unsigned int replace_count = 0;
unsigned int str_len = 0;
const unsigned char from = '\\';
const unsigned char to = '/';
int i;
@dimavs
dimavs / rr.h
Created May 3, 2011 11:19
reverse and replace in c++
#include <iostream>
#include <string>
#include <algorithm>
unsigned int reverse_and_replace(std::string& str)
{
// reverse string
std::reverse(str.begin(), str.end());
// replace all '\' chars and count number of replaces
@dimavs
dimavs / rr_test.cc
Created May 3, 2011 11:23
Test for rr
#include<gtest/gtest.h>
TEST(Rr, Empty)
{
std::string str("");
unsigned int num = reverse_and_replace(str);
EXPECT_EQ(0, num);
EXPECT_EQ("", str);
}
<!-- vim: set ts=2 et sw=2 sts=2: -->
<configuration>
<system.web>
<customErrors mode="off" />
</system.web>
<system.webServer>
<httpErrors existingResponse="PassThrough" />
HttpPort 8080
HttpBindAddress 0.0.0.0
RtspPort 8554
RtspBindAddress 0.0.0.0
CustomLog -
<Stream test.mp4>
Format rtp
File "/tmp/test.mp4"
</Stream>
<MediaCodecs>
<Include href="media_codecs_google_audio.xml" />
<Include href="media_codecs_google_telephony.xml" />
<Settings>
<Setting name="max-video-encoder-input-buffers" value="9" />
</Settings>
<Encoders>
<!-- Video Hardware -->
<MediaCodec name="OMX.qcom.video.encoder.avc" type="video/avc" >
<Quirk name="requires-allocate-on-input-ports" />
@dimavs
dimavs / bpv.sh
Last active August 9, 2018 05:02
#!/bin/bash
display_usage() {
echo -e "Usage:\n\t$0 <p> <n> <x>\n"
}
if [ $# -le 2 ]; then
display_usage
exit 1
fi