Skip to content

Instantly share code, notes, and snippets.

View rozgo's full-sized avatar

Alex Rozgo rozgo

View GitHub Profile
@rozgo
rozgo / install_opencv2_ubuntu.sh
Last active August 6, 2018 19:58 — forked from arthurbeggs/install_opencv2_ubuntu.sh
Install OpenCV2 in Ubuntu
#!/bin/bash
# curl -s "https://raw.githubusercontent.com/rozgo/scripts/master/install_apps/install_opencv2.sh" | bash
### Dependencies
sudo apt-get update
sudo apt-get install -y build-essential cmake libgtk2.0-dev pkg-config \
python-numpy python-dev libavcodec-dev libavformat-dev \
libswscale-dev libjpeg-dev libpng12-dev libtiff5-dev \
libjasper-dev libopencv-dev checkinstall pkg-config \
@rozgo
rozgo / BDF2_integrate_HLSL.txt
Created March 28, 2018 00:48 — forked from sebbbi/BDF2_integrate_HLSL.txt
BDF2 integrator in HLSL
void BFD2(inout ParticleSimulationDataP1 Particle, float3 Accel)
{
float3 x = Particle.Position;
float3 v = Particle.Velocity;
float3 x1 = Particle.PositionPrev;
float3 v1 = Particle.VelocityPrev;
Particle.Position = (4.0/3.0) * x - (1.0/3.0) * x1 + 1.0 * ((8.0/9.0) * v - (2.0/9.0) * v1 + (4.0/9.0) * Accel * TimeStep2);
Particle.PositionPrev = x;
#include "DynamicalSystemsPrivatePCH.h"
#include "DynamicalUtil.h"
#ifdef EIGEN
#include <Eigen/Core>
#include <Eigen/LU>
#include <Eigen/SVD>
void UDynamicalUtil::SVD(FMatrix& out, const FVector(&PointsA)[3], const FVector(&PointsB)[3], const FVector& CA, const FVector& CB)
// Suppose you have a variable named `future` which implements the `Future` trait.
let future: impl Future = ...;
// This gist demonstrates how to run the future until completion using the `stdweb` crate.
// The various imports.
extern crate futures;
extern crate stdweb;

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@rozgo
rozgo / gstreamer.md
Created November 7, 2017 08:10 — forked from nebgnahz/gstreamer.md
Collections of GStreamer usages

Most GStreamer examples found online are either for Linux or for gstreamer 0.10.

This particular release note seems to have covered important changes, such as:

  • ffmpegcolorspace => videoconvert
  • ffmpeg => libav

Applying -v will print out useful information. And most importantly the negotiation results.

@rozgo
rozgo / mumble_say.rs
Created October 16, 2017 16:46
snippet of code to process stream of raw PCM audio and encode for opus broadcast
pub fn say<'a>(vox_out_rx: futures::sync::mpsc::Receiver<Vec<u8>>,
udp_tx: futures::sync::mpsc::Sender<Vec<u8>>,
crypt_state: Arc<Mutex<ocbaes128::CryptState>>)
-> impl Future<Item = (), Error = Error> + 'a {
// Hz * channel * ms / 1000
let sample_channels: u32 = 1;
let sample_rate: u32 = 16000;
let sample_ms: u32 = 10;
let sample_size: u32 = sample_rate * sample_channels * sample_ms / 1000;
@rozgo
rozgo / varint.rs
Last active June 7, 2017 07:50
Variable-length integer implementation in Rust
use std::io::{self, Result};
/// let mut rdr = Cursor::new(buf);
/// let num = rdr.read_varint().unwrap();
pub trait VarintReader: io::Read {
fn read_varint(&mut self) -> Result<u64> {
fn decode<F>(i : u64, mut next : F) -> u64
@rozgo
rozgo / tmux.cheat
Created May 18, 2017 16:44 — forked from afair/tmux.cheat
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@rozgo
rozgo / genetic.py
Last active February 9, 2016 20:40
small python script that evolves an equation towards a solution
# author : Alex Rozgo
# date : Sun Jun 6 2004
# copyright : DoWhatEverYouWantWithIt LICENSE
# email : alex.rozgo@gmail.com
#
# This is a simple demostration of genetic algorithms.
# Given these digits: '0,1,2,3,4,5,6,7,8,9' the algorithm
# must combine them with these operators '+,-,*,/' and
# find an equation that can evaluate to a given target.
# I'll be using binary encoded genes to represent