Skip to content

Instantly share code, notes, and snippets.

View ivanovaleksey's full-sized avatar

Aleksey Ivanov ivanovaleksey

View GitHub Profile
@ivanovaleksey
ivanovaleksey / schema.sql
Created August 1, 2018 12:32
Abac-rs SQL schema
drop extension "uuid-ossp" cascade;
create extension "uuid-ossp";
drop type abac_attribute cascade;
create type abac_attribute as (
value text,
key text,
namespace_id uuid
);
@ivanovaleksey
ivanovaleksey / error-chain.rs
Last active December 5, 2018 13:45
Migrate from error-chain to failure
error_chain! {
foreign_links {
Diesel(::diesel::result::Error);
Json(::serde_json::Error);
Mqtt(::rumqtt::Error);
Utf8(::std::string::FromUtf8Error);
Uuid(::uuid::ParseError);
}
errors {
@ivanovaleksey
ivanovaleksey / seeds.sql
Last active April 3, 2018 08:57
signals-rs seeds
-- table room
DELETE FROM room;
INSERT INTO room (id)
SELECT uuid_generate_v4()
FROM
generate_series(1, 3);
-- table room
@ivanovaleksey
ivanovaleksey / room_agent.rs
Last active March 19, 2018 11:25
Enum with integer in DB
use uuid::Uuid;
use models::{Agent, Room};
use schema::room_agent;
#[derive(Associations, Queryable, Debug)]
#[table_name = "room_agent"]
#[belongs_to(Agent)]
#[belongs_to(Room)]
pub struct RoomAgent {
@ivanovaleksey
ivanovaleksey / main.rs
Created December 25, 2017 11:55
GtkRevealer
extern crate gtk;
use gtk::*;
fn main() {
if gtk::init().is_err() {
eprintln!("failed to initialize GTK Application");
std::process::exit(1);
}
let window = Window::new(WindowType::Toplevel);
@ivanovaleksey
ivanovaleksey / videoroom.md
Created December 14, 2017 15:58
Describe videoroom plugin flow
  1. OUT: Join
{request: "join", room: 1234, ptype: "publisher", display: "a"}

Создается participant (с типом publisher) и добавляется в комнату.

g_hash_table_insert(videoroom->participants, janus_uint64_dup(publisher->user_id), publisher);
@ivanovaleksey
ivanovaleksey / out.sh
Created December 7, 2017 11:39
FFmpeg: RTP - MP4
#!/bin/bash
ffmpeg \
-protocol_whitelist file,udp,rtp -i sdp.test \
-c:v libx264 -c:a aac \
-y test.mp4
# ffmpeg \
# -protocol_whitelist file,rtp,udp -i sdp.test \
require 'dry-struct'
module Types
include Dry::Types.module
end
class Button < Dry::Struct
attribute :text, Types::String
end
@ivanovaleksey
ivanovaleksey / The Technical Interview Cheat Sheet.md
Created March 4, 2017 09:53 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
@ivanovaleksey
ivanovaleksey / iterm2-solarized.md
Created March 2, 2017 12:59 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k