Skip to content

Instantly share code, notes, and snippets.

#include <iostream>
#include <vector>
#include <set>
#include <unordered_map>
#include <queue>
#include <time.h>
#include <bitset>
#include <algorithm>
#include <functional>
@mkamilov
mkamilov / GetIpv6TemporaryAddress.cpp
Last active December 4, 2018 04:53
get ipv6 address from Windows
#include <iostream>
#include <winsock2.h>
#include <iphlpapi.h>
#include <WS2tcpip.h>
#pragma comment(lib, "IPHLPAPI.lib")
#pragma comment(lib, "Ws2_32.lib")
using namespace std;
static char* ConvertLPWSTRToLPSTR(LPWSTR lpwszStrIn)
@mkamilov
mkamilov / counter.py
Created February 6, 2018 09:43
spam counter
#!/usr/bin/python
class Filter:
spamWords = ["bad", "giveaway"]
def __init__(self):
pass
def getSpamWordsCount(self, userId, post):
count = 0
for s in self.spamWords:
#include <iostream>
#include <vector>
#include <list>
#include <algorithm>
using namespace std;
struct PrimitiveInfo
{
list<int> numbers;
#include <iostream>
#include <thread>
using namespace std;
void func1()
{
cout << "func1 " << endl;
}
@mkamilov
mkamilov / CMakeLists.txt
Created November 13, 2017 15:39
gtest sample
cmake_minimum_required(VERSION 2.6)
add_definitions( -DGTEST_HAS_PTHREAD=1 )
set(GMOCK_ROOT /home/miradham/cpp/gtest/googletest-master/googlemock/)
set(GTEST_ROOT /home/miradham/cpp/gtest/googletest-master/googlemock/gtest/)
# Locate GTest
find_package(GTest REQUIRED)
find_package(GMock REQUIRED)
#add_subdirectory(googletest-master)
include_directories(${GTEST_INCLUDE_DIRS})
package warmup;
public class MyCustomHeap {
int[] mHeap;
int mSize;
public MyCustomHeap(int capacity) {
mSize = 0;
mHeap = new int[capacity];
}
@mkamilov
mkamilov / CMakeLists.txt
Created July 31, 2017 08:14
json-glib with jsonobject. Can convert nested json as well
cmake_minimum_required (VERSION 2.4)
project (json-glib-demo)
find_package(PkgConfig REQUIRED)
pkg_search_module(JSONGLIB REQUIRED json-glib-1.0)
add_executable (json-glib-demo jsontest.cpp)
include_directories(${JSONGLIB_INCLUDE_DIRS})
target_link_libraries(json-glib-demo ${JSONGLIB_LIBRARIES})
@mkamilov
mkamilov / CMakeLists.txt
Created July 21, 2017 07:51
exa,ple for curl with cmake
cmake_minimum_required (VERSION 3.5)
project (curl-demo)
set(CURL_LIBRARY "-lcurl")
find_package(CURL REQUIRED)
add_executable (curl-demo convert.cpp)
include_directories(${CURL_INCLUDE_DIR})
target_link_libraries(curl-demo ${CURL_LIBRARIES})
@mkamilov
mkamilov / CMakeLists.txt
Created July 21, 2017 02:28
json-glib example
cmake_minimum_required (VERSION 2.4)
project (json-glib-demo)
find_package(PkgConfig REQUIRED)
pkg_search_module(JSONGLIB REQUIRED json-glib-1.0)
add_executable (json-glib-demo jsontest.cpp)
include_directories(${JSONGLIB_INCLUDE_DIRS})
target_link_libraries(json-glib-demo ${JSONGLIB_LIBRARIES})