Skip to content

Instantly share code, notes, and snippets.

@surinkim
surinkim / CSnapDialog.h
Last active August 29, 2015 14:26
A simple template class which implements snap-to-edge functionality for some QWidgets.
#include <QWidget>
const int ENABLE_STICK_VALUE = 50;
template< typename T>
class CSnapDialog
{
public:
CSnapDialog( T* source )
@surinkim
surinkim / AudioWrapper.h
Last active October 5, 2015 16:56
xp audio handling
/*
이 클래스는 xp이면, Windows Audio Mixer API를,
vista 이후 버전이면, WASAPI를 사용하여 Speaker/Mic를 제어할 수 있게 한다.
참고로, WASAPI(Windows Audio Session API)는 vista 이후 버전만 지원한다.
Windows Audio Mixer API로도, vista 이후 버전에서 speaker 장치의 대부분 기능을 제어할 수 있지만,
결정적으로, Master Volume을 조정할 수 없는 약점이 있다.
Mic 제어는 Windows Audio Mixer API로 xp/win7 모두 제어가능하다.
따라서, Mic 제어는 os 구분없이 Windows Audio Mixer API를 사용한다.
@surinkim
surinkim / AudioWrapper.cpp
Last active February 20, 2018 01:58
xp audio handling
#include "AudioWrapper.h"
#include <QSysInfo>
#include <QCoreApplication>
AudioWrapper::AudioWrapper(void)
: m_isVistaLater( false )
, m_curPid( 0 )
{
CoInitialize( NULL );
input {
file {
path => "./logs/*.log"
start_position => "beginning"
}
}
filter {
// schedule_read is called o start reading
void connection::connect()
{
boost::asio::ip::tcp::resolver resolver(_io);
boost::asio::ip::tcp::resolver::query query(_hostname, std::to_string(_port));
boost::asio::ip::tcp::resolver::iterator iterator = resolver.resolve(query);
boost::system::error_code ec;
boost::asio::connect(_socket, iterator, ec);
if (ec)
import functools
import logging
import graypy
import json
import time
import random
from collections import defaultdict, deque
from flask import Flask, jsonify, g
app = Flask(__name__)
import tenacity
import random
import time
start_time = time.time()
def do_something():
if random.randint(0, 0) == 0:
print("Failure")
raise RuntimeError
@surinkim
surinkim / gitflow-breakdown.md
Created March 18, 2019 06:44 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@surinkim
surinkim / OpenSSL-1_1_0-stable-VS2015.md
Created June 8, 2020 02:57 — forked from terrillmoore/OpenSSL-1_1_0-stable-VS2015.md
Building OpenSSL 1.1.0 with Microsoft VS 2015

Building OpenSSL 1.1.0 with Microsoft VS 2015

MCCI needs OpenSSL for a Windows project (that will be cross-platform). A casual search didn't turn up either a good source for cross-platform libraries, which meant we have to build them ourselves. A deeper search found a detailed guide here, and yet the details don't match what I found when I checked out the code; and the post doesn't talk about doing it directly from GitHub (which I wanted to do).

Here's the procedure for building OpenSSL on 64-bit Windows 10, with Visual Studio 2015. Others (July 2019) report that this procedure works with Visual Studio 2017 as well. I've not had a chance to try with Visual Studio 2019.

As this procedure dates from late 2016, you may find that there's a CMake or other, newer, procedure that's more suitable.

  1. If you don't have it, please install git bash from git-scm.com.
import os
import sys
import boto3
from botocore.exceptions import ClientError
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from email.mime.application import MIMEApplication
# Replace sender@example.com with your "From" address.
# This address must be verified with Amazon SES.