Skip to content

Instantly share code, notes, and snippets.

View viktorku's full-sized avatar

Viktor Kunovski viktorku

View GitHub Profile
@viktorku
viktorku / problematic_miltithreading.cpp
Created January 11, 2019 11:59 — forked from facontidavide/problematic_miltithreading.cpp
This simple multithreading C++ may sometimes crash (SIGSEGV) or remain blocked forever inside waitStart. Can you figure out why?
#include <iostream>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <atomic>
// The purpose of the this apparently fine application is to make you appreciate thread santizers
// https://clang.llvm.org/docs/ThreadSanitizer.html
class Foo{
@viktorku
viktorku / eqc.md
Created September 4, 2018 23:51 — forked from efcasado/eqc.md
A gentle introduction to (Erlang) QuickCheck

Erlang QuickCheck

What is QuickCheck?

QuickCheck is a language for stating properties of programs.

?FORALL(X, nat(), X*X >= 0)
@viktorku
viktorku / systemd-prblm.service
Created August 29, 2018 09:37 — forked from nickjacob/systemd-prblm.service
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/ech "2 + 2 = ${MYVAR}"
@viktorku
viktorku / 32FC1_depth_image_to_uint8.cpp
Created May 23, 2018 12:25 — forked from knorth55/32FC1_depth_image_to_uint8.cpp
Processing 32FC1 image by pixel, convert it to uint8 array and put data in to ROS sensor_msgs/Image
sensor_msgs::Image depth_image;
std::vector<uint8_t> depth_image_vector;
int32_t width = 320; // width example
int32_t height = 240; // height example
float* depth_data; //original data
depth_image.step = 4*width; // one pixel data size of 32FC1 is 4 bytes;
for (int count=0; count < width * height; count++)
{
@viktorku
viktorku / multiprocess_with_instance_methods.py
Created March 14, 2018 12:35 — forked from bnyeggen/multiprocess_with_instance_methods.py
Example showing how to use instance methods with the multiprocessing module
from multiprocessing import Pool
from functools import partial
def _pickle_method(method):
func_name = method.im_func.__name__
obj = method.im_self
cls = method.im_class
if func_name.startswith('__') and not func_name.endswith('__'): #deal with mangled names
cls_name = cls.__name__.lstrip('_')
func_name = '_' + cls_name + func_name
@viktorku
viktorku / foo_names.md
Created December 11, 2016 19:27 — forked from mihaitodor/foo_names.md
Map slugs to course names

https://archive.org/download/archiveteam_coursera_20160627114043/coursera_20160627114043.megawarc.warc.gz

  • bigdata = Web Intelligence and Big Data
  • clinical skills = Teaching and Assessing Clinical Skills
  • comp finance = Introduction to Computational Finance and Financial Econometrics
  • data sci = Introduction to Data Science
  • dmathgen = 离散数学概论 Discrete Mathematics Generality
  • global introuslaw = The Global Student's Introduction to U.S. Law
  • global theatre = Theatre and Globalization
  • global theatre = Theatre and Globalization
  • inforiskman = Information Security and Risk Management in Context
var leafDoc;
var traverseDependencies = function observe(options, fn) {
if (!options ||
!options.target ||
!options.depTree ||
!options.depTree.length) {
fn();
}
@viktorku
viktorku / polymer-requirejs
Created February 27, 2016 22:40 — forked from tantaman/polymer-requirejs
polymer + requirejs : originally by Scott Miles from: http://jsbin.com/efojap/2/edit
<!doctype html>
<html>
<head>
<title>Polymer and RequireJS</title>
<script src="http://polymer.github.io/cdn/polymer.min.js"></script>
</head>
<body>
<!-- #foo -->
<div id="foo">the foo has no joy.</div>