Skip to content

Instantly share code, notes, and snippets.

@stvkoch
stvkoch / DAG_MySQL.sql
Created December 26, 2017 10:45 — forked from xib/DAG_MySQL.sql
Direct Acyclic Directed Graph in MySQL database
-- Based on the original articel at http://www.codeproject.com/Articles/22824/A-Model-to-Represent-Directed-Acyclic-Graphs-DAG-o
-- Here is a port to MySQL
-- Edge table
DROP TABLE IF EXISTS `Edge`;
CREATE TABLE IF NOT EXISTS `Edge` (
`id` int(11) NOT NULL,
`entry_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the incoming edge to the start vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column',
`direct_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the direct edge that caused the creation of this implied edge; direct edges contain the same value as the Id column',
`exit_edge_id` int(11) DEFAULT NULL COMMENT 'The ID of the outgoing edge from the end vertex that is the creation reason for this implied edge; direct edges contain the same value as the Id column',
@stvkoch
stvkoch / openCv.sh
Created November 10, 2017 18:38
install FFmpeg + deps + openCV
sudo add-apt-repository ppa:mc3man/gstffmpeg-keep
sudo add-apt-repository ppa:jon-severinsson/ffmpeg
sudo apt-get update
# ffmpeg deps
sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev texi2html zlib1g-dev libsdl1.2-dev v4l-utils
@stvkoch
stvkoch / gist:557aca82c730f0d7dee21a9f0f5b2df4
Last active October 26, 2017 11:47
defaultOfIfEmpty operator RXjs
Rx.Observable.prototype.defaultOfIfEmpty = function (defaultObservable) {
var source = this;
var isEmpty = true;
return Rx.Observable.create(function(observer) {
source.subscribe(
function(value) {
isEmpty = false;
observer.next(value);
},
@stvkoch
stvkoch / gist:3b2e0c04196f28bb00f60527e7ebea1b
Created August 24, 2017 21:07
get content-type of url
function getContentType {
curl -s -o /dev/null -w '%{content_type}' $1
}
@stvkoch
stvkoch / tmux-cheatsheet.markdown
Created May 4, 2017 11:15 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@stvkoch
stvkoch / gist:735bd89f5afd0acc48fccd46a698f590
Created April 13, 2017 16:10
terms of service and privacy policy
<h2>inov.es Terms of Service and Privacy Policy</h2>
<h3>1. Terms</h3>
<p>By accessing the website at <a href="http://inov.es">http://inov.es</a>, you are agreeing to be bound by these terms of service, all applicable laws and regulations, and agree that you are responsible for compliance with any applicable local laws. If you do not agree with any of these terms, you are prohibited from using or accessing this site. The materials contained in this website are protected by applicable copyright and trademark law.</p>
<h3>2. Use License</h3>
<ol type="a">
<li>
@stvkoch
stvkoch / move_to_rds.rb
Created January 9, 2017 00:44 — forked from guenter/move_to_rds.rb
A quick and dirty script to move a database into Amazon RDS (or any other database). Can transfer part of the data beforehand.
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
export function observableFromStore(store) {
return Observable.create(observer =>
store.subscribe(() => observer.next(store.getState()))
);
}
@stvkoch
stvkoch / LinkThatWorksWithRedux.js
Created August 28, 2016 20:48 — forked from gaearon/LinkThatWorksWithRedux.js
Drop-in replacement for React Router <Link> that works with React Redux optimizations (https://github.com/reactjs/react-router/issues/470)
// While I claim this is a drop-in replacement, it is a little bit slower.
// If you have hundreds of links, you might spend a few more milliseconds rendering the page on transitions.
// KNOWN ISSUES WITH THIS APPROACH:
// * This doesn't work great if you animate route changes with <TransitionGroup>
// because the links are going to get updated immediately during the animation.
// * This might still not update the <Link> correctly for async routes,
// as explained in https://github.com/reactjs/react-router/issues/470#issuecomment-217010985.
@stvkoch
stvkoch / Enhance.js
Created August 24, 2016 06:12 — forked from sebmarkbage/Enhance.js
Higher-order Components
import { Component } from "React";
export var Enhance = ComposedComponent => class extends Component {
constructor() {
this.state = { data: null };
}
componentDidMount() {
this.setState({ data: 'Hello' });
}
render() {