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 <assert.h> | |
#include <sys/ioctl.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <linux/errqueue.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
#include <assert.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <arpa/inet.h> | |
#include <sys/socket.h> | |
#include <sys/types.h> | |
#include <linux/errqueue.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
#include <iostream> | |
#include <string> | |
#include <array> | |
#include <type_traits> | |
using std::cout; | |
using std::endl; | |
using std::array; | |
void func() { |
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 <string> | |
#include <array> | |
#include <type_traits> | |
using std::cout; | |
using std::endl; | |
using std::array; | |
template<typename... Ts> |
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 <algorithm> | |
static int sign(int64_t v) { return (0 < v) - (v < 0); }; | |
static int rotDir (const Point2D& a, const Point2D& b, const Point2D& c) { | |
return sign(int64_t(b.x - a.x)*int64_t(c.y - a.y) - int64_t(b.y - a.y)*int64_t(c.x - a.x)); | |
} | |
int solution(vector<Point2D> &A) { | |
if (A.size() < 3) return -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
#!/bin/sh | |
if [ -z $1 ] | |
then | |
echo "Usage: $0 { p | l | a }. p - portrait, l - landscape, a - auto" | |
elif [[ $1 == a* ]] | |
then | |
echo "Turning on automatic rotation" | |
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:1 | |
else |
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
/*********************************************************************************** | |
* C++11 Performance and Memory Benchmark * | |
* Copyright (C) 2015 Alexey Novikov (Email: alexey_AT_novikov_DOT_io) * | |
* All rights reserved. * | |
* * | |
* Redistribution and use in source and binary forms, with or without * | |
* modification, are permitted provided that the following conditions are met: * | |
* * | |
* 1. Redistributions of source code must retain the above copyright notice, this * | |
* list of conditions and the following disclaimer. * |
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
#ifdef BENCH | |
#include <ctime> | |
#include <chrono> | |
#define BENCHMARK_START \ | |
auto t_start = std::chrono::high_resolution_clock::now(); \ | |
std::clock_t c_start = std::clock(); | |
#define BENCHMARK_FINISH( OUT_STREAM, NAME ) \ | |
std::clock_t c_end = std::clock(); \ | |
auto t_end = std::chrono::high_resolution_clock::now(); \ | |
OUT_STREAM << "BENCHMARK \"" << NAME << "\" : " \ |
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
" set UTF-8 encoding | |
set enc=utf-8 | |
set fenc=utf-8 | |
set termencoding=utf-8 | |
" disable vi compatibility (emulation of old bugs) | |
set nocompatible | |
" use indentation of previous line | |
set autoindent | |
" use intelligent indentation for C | |
set smartindent |