Skip to content

Instantly share code, notes, and snippets.

Artem ArtemGr

  • Bizlink
Block or report user

Report or block ArtemGr

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ArtemGr
ArtemGr / snippets.php
Last active Aug 29, 2015
PHP snippets.
View snippets.php
// 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.
@ArtemGr
ArtemGr / mod_sustest.c
Created Mar 30, 2014
SUSPENDED test case
View mod_sustest.c
// 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>
@ArtemGr
ArtemGr / event.patch
Last active Aug 29, 2015
A hack to make Apache SUSPENDED work with HTTP.
View event.patch
--- 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);
}
/*
@ArtemGr
ArtemGr / eador-unpack.cc
Last active Aug 29, 2015
Eador: Masters of the Broken World - savegame unpacker
View eador-unpack.cc
// 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>
@ArtemGr
ArtemGr / Cargo.toml
Created Jan 18, 2015
Test case for json_macros bug
View Cargo.toml
[package]
name = "err"
version = "0.0.1"
authors = ["ArtemGr"]
[[bin]]
name = "test"
path = "test.rs"
[dependencies]
@ArtemGr
ArtemGr / icu.rs
Created Jan 25, 2015
Partial ICU bindings for Rust
View icu.rs
pub mod ICU {
// --- Hand-made ICU bindings ---
// $ apt-get install -y libicu-dev
// To check the argument types:
// $ apt-get install -y libicu52-dbg
// $ cd /usr/lib/x86_64-linux-gnu && gdb libicui18n.so
// ) print utrans_open_52
// ) ptype UChar
// ) ptype UParseError
View thread_local.rs
#![feature(scoped_tls)]
#[macro_use] extern crate nickel;
use nickel::Nickel;
use nickel::router::http_router::HttpRouter;
use nickel::ResponseFinalizer;
struct MyObject;
impl MyObject {
View first_run.log
INFO:cargo::ops::cargo_rustc::fingerprint: fingerprint at: /tmp/yup-oauth2/target/debug/.fingerprint/yup-oauth2-f648bac97266aa1c/lib-yup-oauth2
DEBUG:cargo::ops::cargo_rustc::fingerprint: extra Target { kind: Lib([Lib]), name: "yup-oauth2", src_path: "/tmp/yup-oauth2/src/lib.rs", metadata: Some(Metadata { metadata: "f648bac97266aa1c", extra_filename: "-f648bac97266aa1c" }), tested: true, benched: true, doc: true, doctest: true, harness: true, for_host: false } Profile { opt_level: 0, lto: false, codegen_units: None, rustc_args: None, debuginfo: true, debug_assertions: true, rpath: false, test: false, doc: false } None = def601c33e56949f
DEBUG:cargo::ops::cargo_rustc::fingerprint: extra Target { kind: Lib([Dylib]), name: "serde_macros", src_path: "/root/.cargo/registry/src/github.com-1ecc6299db9ec823/serde_macros-0.4.0/src/lib.rs", metadata: Some(Metadata { metadata: "a56f347bda653264", extra_filename: "-a56f347bda653264" }), tested: true, benched: true, doc: true, doctest: false, harness: true, for_host: true
@ArtemGr
ArtemGr / gist:45741
Created Jan 11, 2009
Moving to FreeBSD 7.1 using Pover Recovery at server4you.de
We couldn’t find that file to show.
@ArtemGr
ArtemGr / gist:51009
Created Jan 23, 2009
Enable optional transparency in PlotKit
View gist:51009
[artemgr@pcbsd /tmp/plotkit-patches]$ git diff
diff --git a/PlotKit/SweetCanvas.js b/PlotKit/SweetCanvas.js
index dcfdfc5..39cbf2c 100644
--- a/PlotKit/SweetCanvas.js
+++ b/PlotKit/SweetCanvas.js
@@ -195,6 +195,10 @@ PlotKit.SweetCanvasRenderer.prototype._renderLineChart = function() {
// faux shadow for firefox
if (this.options.shouldFill) {
+ // Transparent fill.
You can’t perform that action at this time.