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 /
Last active Feb 9, 2016
Merge experiments
package test;
import java.util.ArrayList;
import java.util.Random;
public class Keys implements Comparable<Keys> {
private final int[] keys;
public Keys(final int[] keys) {
this.keys = keys;
ArtemGr /
Last active Jan 4, 2016
Example using JIT-compiled PCRE expressions from Rust.
pub struct PcreJit {
pub re: Mutex<pcre::Pcre>,
/// Map from a capturing group name to its number.
/// `None` if no named capturing groups found or if the `auto_capture` option is given to `PcreJit::new`.
pub names: Option<BTreeMap<String, Vec<usize>>>}
unsafe impl Sync for PcreJit {}
unsafe impl Send for PcreJit {}
impl PcreJit {
/// JIT-compiles the regular expression.
ArtemGr /
Last active Oct 27, 2015
gstring - Rust macros to make strings on stack
/// A helper to build a string on the stack.
/// Given an array it makes a writeable cursor available to the passed code block.
/// Returns a &str slice pointing at memory between the array start and the cursor.
/// Example:
/// use std::io::Write;
/// let mut foobar: [u8; 128] = unsafe {std::mem::uninitialized()};
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/", 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/", metadata: Some(Metadata { metadata: "a56f347bda653264", extra_filename: "-a56f347bda653264" }), tested: true, benched: true, doc: true, doctest: false, harness: true, for_host: true
#[macro_use] extern crate nickel;
use nickel::Nickel;
use nickel::router::http_router::HttpRouter;
use nickel::ResponseFinalizer;
struct MyObject;
impl MyObject {
ArtemGr /
Created Jan 25, 2015
Partial ICU bindings for Rust
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
// ) print utrans_open_52
// ) ptype UChar
// ) ptype UParseError
ArtemGr / Cargo.toml
Created Jan 18, 2015
Test case for json_macros bug
View Cargo.toml
name = "err"
version = "0.0.1"
authors = ["ArtemGr"]
name = "test"
path = ""
ArtemGr /
Last active Sep 7, 2019
Read lines from a pipe as soon as they come out (useful for filtering).
#![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;
enum PipeError {
ArtemGr / makefile
Last active Feb 8, 2018
SPI helper for a PostgreSQL CHECK when using one-to-many with a jsonb.
View makefile
all: spi.o makefile
g++ -shared -o spi.o
cp --remove-destination /var/lib/postgresql/
spi.o: makefile
g++ -g -O2 -Wall -std=c++11 -fpic -c -o spi.o -I/usr/include/postgresql -I/usr/include/postgresql/9.4/server
ArtemGr / BsonJson.cpp
Last active Jan 11, 2019
BSON-JSON with C++ and Rapidjson
View BsonJson.cpp
#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>
You can’t perform that action at this time.