Skip to content

Instantly share code, notes, and snippets.

View andreinechaev's full-sized avatar
🐢
💨 💨 💨

Andrei Nechaev andreinechaev

🐢
💨 💨 💨
View GitHub Profile
@andreinechaev
andreinechaev / matrix_dot.cu
Last active March 31, 2018 00:29
A solution to Nvidia Cuda Course.
#include <stdio.h>
#define N 64
inline cudaError_t checkCudaErr(cudaError_t err, const char* msg) {
if (err != cudaSuccess) {
fprintf(stderr, "CUDA Runtime error at %s: %s\n", msg, cudaGetErrorString(err));
}
return err;
}
@andreinechaev
andreinechaev / make-build.json
Created March 18, 2018 21:48
CMake build sys for Subl
{
"cmd": [
"mkdir -p build && cd build && cmake .. && make && cd .. && ./build/`cat CMakeLists.txt | grep 'project(' | sed 's/project(//' | cut -f1 -d ')'`"
],
"selector": "source.c++",
"shell": true,
}
from nuxeo.nuxeo import Nuxeo
from nuxeo.blob import BufferBlob
import requests
import random
from threading import Thread
rand_url = 'http://thecatapi.com/api/images/get?type='
class ImagePublisher(Thread):
import cv2
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def plot3d(pixels, colors_rgb,
axis_labels=list("RGB"), axis_limits=[(0, 255), (0, 255), (0, 255)]):
"""Plot pixels in 3D."""
# Create figure and 3D axes
@andreinechaev
andreinechaev / main.py
Last active January 3, 2017 14:54
The Lamber Jack auto play
from time import sleep
import pyautogui
import cv2
import numpy as np
def chop_chop(dst):
pyautogui.press(dst)
pyautogui.press(dst)

Nuxeo Queue Importer

Goal

nuxeo-importer-core contains several sample codes that can be adapted to run imports taking advantage of:

  • thread-pooling
  • batching (import several documents inside a given transaction)
  • event processing filtering (enable bulk mode or skip some events)
@andreinechaev
andreinechaev / Streams.java
Created October 7, 2016 20:25
Akka Streams Example
@Test
public void testToTest() throws Exception {
String allInOne = "AllInOne";
sBroker.createTopic(allInOne, 1, 1);
Properties props = new Properties();
props.put(StreamsConfig.APPLICATION_ID_CONFIG, "app_id");
props.put(StreamsConfig.BOOTSTRAP_SERVERS_CONFIG, "localhost:9092");
props.put(StreamsConfig.ZOOKEEPER_CONNECT_CONFIG, "localhost:2181");
extension UIApplication {
class func topViewController(base: UIViewController? = UIApplication.sharedApplication().keyWindow?.rootViewController) -> UIViewController? {
if let nav = base as? UINavigationController {
return topViewController(nav.visibleViewController!)
}
if let tab = base as? UITabBarController,
let selected = tab.selectedViewController {
return topViewController(selected)
}
if let presented = base?.presentedViewController {
@andreinechaev
andreinechaev / main.go
Created March 13, 2016 19:26
Go tool for correcting text in your go projects
package main
import (
"io/ioutil"
"os"
"log"
"strings"
"sync"
"flag"
)
package main
import (
"net/http"
"fmt"
"html/template"
"log"
"regexp"
"database/sql"
"github.com/mattn/go-sqlite3"