This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -std=c++11 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include main.cpp -lglib-2.0 -lboost_system -lboost_coroutine -lboost_context -o test | |
// | |
#include <iostream> | |
#include <thread> | |
#include <chrono> | |
#include <glib.h> | |
#include <boost/coroutine/all.hpp> | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save this file | |
# mac - "~/Library/Application Support/Sublime Text 3/Packages/" | |
# linux - "~/.config/sublime-text-3/Packages/" | |
# NOTE! | |
# ~/.nvm/alias/default must contain full version name. | |
# $ nvm alias default v4.3.5 | |
import os |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// g++ -Wall -o get get.cpp && ./get ::ffff:192.168.111.8 3000 | |
// g++ -Wall -o get get.cpp && ./get 192.168.111.8 3000 | |
// g++ -Wall -o get get.cpp && ./get www.google.com 80 | |
#include <iostream> | |
#include <cstdlib> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <cstring> | |
#include <arpa/inet.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import select | |
import datetime | |
port = 20001 | |
def main(): | |
serversock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
serversock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) | |
serversock.setblocking(0) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM ubuntu:14.04 | |
MAINTAINER Seonghwan Lee <[email protected]> | |
RUN cd /etc/apt && \ | |
sed -i 's/archive.ubuntu.com/kr.archive.ubuntu.com/g' sources.list | |
RUN apt-get update | |
RUN apt-get install -y git curl python | |
RUN apt-get install -y ruby2.0 ruby2.0-dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# pywin32 must be installed | |
# pip install wmi | |
import win32gui | |
import win32process | |
import win32pdhutil | |
import wmi | |
procs = wmi.WMI().Win32_Process() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _findMapValue(container, key) (container.end() != find_if(container.begin(), container.end(), [](decltype(container)::value_type it) { return it.first == key; })) | |
// c++11 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bool exec(const std::string &cmd, std::string* out) | |
{ | |
FILE* pipe = popen(cmd.c_str(), "r"); | |
if (pipe == NULL) { | |
return false; | |
} | |
char buffer[2048]; | |
while (!feof(pipe)) { | |
if (fgets(buffer, sizeof(buffer), pipe) != NULL) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"> | |
<!-- $HOME/.config/font-manager/local.conf --> | |
<fontconfig> | |
<match> | |
<test name="family"> | |
<string>sans-serif</string> | |
</test> | |
<edit name="family" mode="prepend" binding="same"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/2281739/automatically-adding-enter-exit-function-logs-to-a-project | |
#define KNRM "\x1B[0m" | |
#define KRED "\x1B[31m" | |
#define KGRN "\x1B[32m" | |
#define KYEL "\x1B[33m" | |
#define KBLU "\x1B[34m" | |
#define KMAG "\x1B[35m" | |
#define KCYN "\x1B[36m" | |
#define KWHT "\x1B[37m" |