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
#include <iostream> | |
#include <unordered_map> | |
#include <boost/fusion/include/std_pair.hpp> | |
#include <boost/spirit/include/qi.hpp> | |
#include <boost/spirit/include/qi_grammar.hpp> | |
namespace qi = boost::spirit::qi; | |
template <class String, class Iterator = typename String::const_iterator> | |
struct query_string : qi::grammar<Iterator, std::unordered_map<String, String>()> { |
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
# nyan! | |
TARGET = out | |
SRC = http_client.cc | |
# compiler configs | |
CFLAGS = /nologo /c /EHsc /GL /GS /Gy /MD /MP /O2 /W3 /Zi /sdl /Fd:$(TARGET).pdb | |
INCPATH = /I"$(BOOST_INCLUDEDIR)" /I"$(OPENSSL_INCLUDEDIR)" | |
DEFINES = /D_WIN32_WINNT=0x0601 |
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
#include <iostream> | |
#include <chrono> | |
int main(int argc, char const* argv[]) { | |
const auto before = std::chrono::system_clock::now(); | |
for (long long int i = 0; i < 100000000; i++) { | |
i + 1; | |
} |
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
#include <iostream> | |
#include <unordered_map> | |
extern "C" { | |
#include <arpa/inet.h> | |
#include <sys/socket.h> | |
#include <ifaddrs.h> | |
} | |
std::unordered_map<std::string, std::string> get_if_list() { |
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
source 'https://rubygems.org' | |
gem 'slack-ruby-client' | |
gem 'eventmachine' | |
gem 'faye-websocket' |
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 ruby:2.6-alpine | |
ADD bot.rb config.rb Gemfile /usr/src/app/ | |
WORKDIR /usr/src/app/ | |
RUN \ | |
apk upgrade --no-cache && \ | |
apk add --no-cache --virtual gem-dependencies \ | |
libgcc \ | |
libstdc++ \ |
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
{-# OPTIONS_GHC -Wall -Werror #-} | |
import Control.Applicative | |
qq :: Int -> Int -> String | |
qq x y = show x ++ "x" ++ show y ++ "=" ++ show (x * y) | |
main :: IO () | |
main = mapM_ putStrLn $ qq <$> [1..9] <*> [1..9] |
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
#!/usr/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "usage: $0 DEST" | |
exit -1 | |
fi | |
if [ ! -d $1 ]; then | |
echo "error: no such directory $1" | |
exit -1 |
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
all: parser | |
parser: ./rhp.cc | |
clang++ -std=c++14 -Wall -Wextra -pedantic -O2 -march=native $< -o $@ | |
debug: parser_debug | |
parser_debug: ./rhp.cc | |
clang++ -std=c++14 -Wall -Wextra -pedantic -g -O0 $< -o $@ |
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
#include <cstdint> | |
template <class Address, class Register, Address address> | |
struct reg_t { | |
static inline void write(Register value) { | |
*reinterpret_cast<volatile Address*>(address) = value; | |
} | |
static inline Register read() { | |
return *reinterpret_cast<volatile Address*>(address); |