This file contains 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 sugar for use of ranged-based for over iterator | |
// e.g. | |
// for (auto &x : range(begin, end)) { ... } | |
// | |
constexpr struct | |
{ | |
template<typename ForwardIterator> | |
class range_helper | |
{ |
This file contains 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 <string> | |
struct A | |
{ | |
// You need to explicitly define constructor and destructor | |
union | |
{ |
This file contains 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 to $HOME/.local/share/systemd/user/goagent.service | |
# Install goagent to $HOME/.local/share/goagent | |
# | |
# Enable goagent by | |
# systemctl --user enable goagent | |
# systemctl --user start goagent | |
# | |
[Unit] | |
Description=GoAgent |
This file contains 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
function(iter, k) { | |
var array = []; | |
var count = 0; | |
for (var val = iter(); val !== undefined; val = iter()) { | |
count ++; | |
if (array.length < k) | |
array.push_back(val); | |
else { | |
var luck = rand() % count; | |
if (luck < k) { |
This file contains 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
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
* This program explains the following behaviour of epoll: | |
* When multriple threads are waiting on same epoll instance simultaneously, | |
* I/O event raised from a file registered on the epoll instance with edge | |
* trigger mode cause exactly one thread to wake up; while with level trigger | |
* mode cause at least one thread to wake up, depends on the event-consuming | |
* time and the schedule of threads. | |
* | |
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * | |
* Compile this file with -DUSE_EDGE_TRIGGER to see the behaviour of edge |
This file contains 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" encoding="utf-8"?> | |
<resources> | |
<!-- Base application theme. --> | |
<style name="AppTheme" parent="@style/Theme.AppCompat.Light"> | |
</style> | |
<style name="AppTheme.NoActionBar" parent="AppTheme"> | |
<item name="android:windowNoTitle">true</item> |
This file contains 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
_ = require 'lodash' | |
### | |
aggr = aggregate (['a', 'b']) | |
aggr ([{ a: 1, b:1, c:1 }, | |
{ a: 1, b:1, c:1 }, | |
{ a: 1, b:1, c:2 }, | |
{ a: 1, b:2, c:1 }, |
This file contains 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
/* | |
* Copyright (C) 2014 LAN Xingcan | |
* All right reserved | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
This file contains 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
// Git tag must in format of vA.B.CrcD, e.g. v1.0 or v1.0.2rc4, | |
// where A, B, C, D is major version code, minor version code, | |
// fix version code and RC number respectively. | |
// Minor, fix and rc number are optional, and rc number is simply | |
// ignored when calculating version code | |
// | |
// In build.gradle: | |
// | |
// apply from: './path/to/version.gradle' | |
// |
This file contains 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
/* | |
* Copyright (C) 2016 LAN Xingcan | |
* All right reserved | |
* | |
* Permission to use, copy, modify, and/or distribute this software for any | |
* purpose with or without fee is hereby granted, provided that the above | |
* copyright notice and this permission notice appear in all copies. | |
* | |
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
OlderNewer