Skip to content

Instantly share code, notes, and snippets.

View LightVolk's full-sized avatar

Konstantin LightVolk

  • New-York
View GitHub Profile
public string PostMethod(byte[] bytes)
{
string postUrl = "https://asr.yandex.net/asr_xml?" +
"uuid=01ae13cb744628b58fb536d496daa1e6&" +
"key="+your_api_key_here+"&" +
"topic=queries";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(postUrl);
request.Method = "POST";
request.Host = "asr.yandex.net";
@LightVolk
LightVolk / Windows Log
Created December 30, 2013 16:45
Create Windows log (or connect to it) and get log message from journal
interface ILog
{
IEnumerable<EventLogEntry> GetLogMessages();
}
class WinLog:ILog
{
private EventLog _EventLog;
public WinLog(String logName)
//sample only, code completely untested.
template <typename Key, typename Value>
QMap<Key, Value> hashToMap(const QHash<Key, Value> hash) {
QMap<key, Value> result;
QHashIterator<Key, Value> it(hash);
while (it.hasNext()) {
it.next();
result.insert(it.key(), it.value());
}
return result;
@LightVolk
LightVolk / getHtml4pda.py
Created March 14, 2013 15:07
Get Html from 4pda. Test func.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import urllib2
import os
import sys
import lxml.html
def search_4pda(search):
headers = {'User-Agent' : 'Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)'}
req = urllib2.Request("http://4pda.ru/forum/index.php?act=Search&source=all&forums=all&query="+search+"&result=topics", None, headers)
response = urllib2.urlopen(req)
@LightVolk
LightVolk / gist:4270022
Created December 12, 2012 17:54
How to make QMap in QMap : Qmap<QString,QQVariant>,where QVariant= QString,int
QVariantMap target,temp;
temp["KEY1"]=42;
temp["KEY2"]=24;
target["ID"]=temp;