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
( head -n 1 /usr/share/applications/defaults.list && ack --match '^(?<mimetype>.+)=gedit.desktop$' --output '$+{mimetype}=sublime-text.desktop' /usr/share/applications/defaults.list ) | tee ~/.local/share/applications/defaults.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
#!/data/data/com.termux/files/usr/bin/bash | |
#set -x | |
SUDO_SH=/data/data/com.termux/files/usr/bin/sh | |
QUOTED_SUDO_ARGS=$(printf '%q' $"$(printf '%q ' "$@")") | |
#QUOTED_SUDO_ARGS=$(printf '%q ' \"$@\") | |
printf '%s\n' "$QUOTED_SUDO_ARGS" | |
SU_C_ARGS=("LD_LIBRARY_PATH=$PREFIX/lib" "$SUDO_SH" "-c" "$QUOTED_SUDO_ARGS") |
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
thor | |
├── contrib | |
│ ├── bar | |
│ └── foo | |
├── include | |
│ └── thor | |
│ ├── lib-1 | |
│ │ └── hdr-1.h // names in thor::lib-1 | |
│ └── lib-2 | |
│ └── hdr-2.h // names in thor::lib-2 |
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 <stdio.h> | |
#define NUM_OF_ELEMENTS(array) (sizeof(array)/sizeof(array[0])) | |
main() { | |
int ys[] = {2011, 2012, 2100, 2400}; | |
int i = 0, m = 0; | |
for(i = 0; i < NUM_OF_ELEMENTS(ys); i++) { |
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
// ref: https://plus.google.com/u/0/111121989384217966500/posts/LjSZjmKGpjj | |
// Tested with gcc 4.6.3 | |
// $ g++ -std=c++0x THISFILE && a.out | |
#include <cassert> | |
#include <type_traits> | |
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
struct _List_node_base | |
{ | |
_List_node_base* _M_next; | |
_List_node_base* _M_prev; | |
// .... | |
}; | |
template<typename _Tp> | |
struct _List_node : public __detail::_List_node_base | |
{ |
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++0x filter.cpp | |
#include <iterator> | |
#include <algorithm> | |
template <class Sequence, class Predicate> | |
Sequence filter(const Sequence& seq, Predicate pred) | |
{ | |
Sequence result; | |
std::copy_if(begin(seq), end(seq), back_inserter(result), pred); | |
return result; |
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
$ ./balad -h | |
LBS mode usage: | |
balad [OPSIONS...] --lsb LBS-HOST:LBS-PORT... | |
RBS mode usage: | |
balad [OPSIONS...] --rsb RBS-HOST:RBS-PORT:PROTOCOL-LEVEL... | |
Allowed options: | |
-h [ --help ] Produce this help message and exit | |
-c [ --concurrency ] arg (=1) Concurrency (number of threads) | |
-b [ --buffer ] arg (=1024) Size of session buffer in bytes |
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
void handle_read(const sys::error_code& error, | |
size_t bytes_transferred) | |
{ | |
if(error) | |
{ | |
delete this; | |
return; | |
} | |
async_write( |