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
#![feature(mpsc_select, box_syntax)] | |
use std::io; | |
use std::process::Command; | |
use std::sync::mpsc::{channel, Receiver, Select}; | |
use std::string::FromUtf8Error; | |
use std::thread::spawn; | |
#[derive(Debug)] | |
enum PipeError { |
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
all: spi.so | |
spi.so: spi.o makefile | |
g++ -shared -o spi.so spi.o | |
cp --remove-destination spi.so /var/lib/postgresql/spi.so | |
spi.o: spi.cc makefile | |
g++ -g -O2 -Wall -std=c++11 -fpic -c -o spi.o -I/usr/include/postgresql -I/usr/include/postgresql/9.4/server spi.cc | |
clean: |
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 <mongo/bson/bson.h> | |
using mongo::BSONObj; using mongo::BSONObjBuilder; | |
using mongo::BSONArray; using mongo::BSONArrayBuilder; | |
using mongo::BSONElement; | |
#include <rapidjson/document.h> | |
#include <rapidjson/reader.h> | |
#include <rapidjson/writer.h> | |
#include <rapidjson/stringbuffer.h> |
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
// Cygwin: cd /tmp; g++ -O3 -fno-inline-functions -Wall -std=c++11 /c/spool/Promo/personal/artemgr/games/eador.cc -o eador -lz | |
// MinGW: g++ -static -O3 -fno-inline-functions -Wall -std=c++11 -I/boost/include/boost-1_53 eador.cc -o eador.exe -lz | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/stat.h> | |
#include <unistd.h> | |
#include <ctype.h> | |
#include <errno.h> | |
#ifdef __MINGW32__ |
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
// Cygwin: cd /tmp; g++ -O3 -fno-inline-functions -Wall -std=c++11 eador-unpack.cc -o eador-unpack -lz | |
// MinGW: g++ -static -O3 -fno-inline-functions -Wall -std=c++11 eador-unpack.cc -o eador-unpack -lz && upx eador-unpack.exe | |
// "They are just using ionic zip to compress part of the contents" | |
// http://www.cheathappens.com/show_board2.asp?headID=117333&titleID=19617&onPage=11 | |
#include <stdlib.h> | |
#include <stdio.h> | |
#include <sys/stat.h> | |
#include <unistd.h> |
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
--- a/server/mpm/event/event.c 2013-07-11 16:24:26.000000000 +0400 | |
+++ b/server/mpm/event/event.c 2014-03-31 12:05:54.314892858 +0400 | |
@@ -1044,6 +1044,7 @@ | |
} | |
} | |
else if (cs->pub.state == CONN_STATE_SUSPENDED) { | |
+ cs->c->vhost_lookup_data = cs; // A hack to save the `cs` for `resume_suspended`. | |
apr_atomic_inc32(&suspended_count); | |
} | |
/* |
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
// apxs -i -a -c mod_sustest.c | |
// SetHandler sustest | |
#include <httpd.h> | |
#include <http_protocol.h> | |
#include <http_config.h> | |
#include <http_request.h> | |
#include <http_log.h> | |
#include <http_connection.h> | |
#include <ap_mpm.h> |
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
// Logging. | |
error_log (print_r ($whatever, true)); | |
foreach (debug_backtrace() as $en) | |
error_log (' ' . (empty ($en['file']) ? '' : $en['file'] . ':' . $en['line']) . '; ' . $en['function']); | |
file_put_contents ('/tmp/php.delme.log', print_r ($..., true) . "\n", FILE_APPEND); | |
// Interpolation hack (http://php.net/manual/en/language.types.string.php#91628). | |
function _e ($v) {return $v;} // Usage: $_e = '_e'; "foo {$_e ('bar')}" | |
// Casting a variable in IntelliJ. |
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
CREATE OR REPLACE FUNCTION public."largestTables" ( | |
) | |
RETURNS TABLE ( | |
relation text, | |
size text | |
) AS | |
$body$ | |
BEGIN | |
-- http://wiki.postgresql.org/wiki/Disk_Usage |
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
#undef __STRICT_ANSI__ // memmem | |
#include <string> | |
using std::string; | |
#include <iostream> | |
using std::cout; using std::cerr; using std::endl; | |
#include <fstream> | |
using std::ofstream; | |
#include <boost/filesystem.hpp> | |
namespace fs = boost::filesystem; |