Skip to content

Instantly share code, notes, and snippets.

View optozorax's full-sized avatar

ilya sheprut optozorax

View GitHub Profile
@optozorax
optozorax / 6.sql
Created March 22, 2020 11:59
Защита 6 лаба Базы Данных БД ФПМИ НГТУ
-- Для каждого изделия найти среди поставлявшихся для него деталей те,
-- что имеют наименьшее число поставщиков. Изделия в списке должны быть
-- все. Вывести: номер изделия, номер детали, число поставщиков.
select jj.n_izd, z.n_det as min_post_izd, z.count as post_count
from j jj
left join lateral (
select n_det, count
from (
select p.n_det, (
select count(distinct n_post)
@optozorax
optozorax / Cargo.toml
Created March 10, 2020 10:49
Inline sticker telegram bot teloxide
[package]
name = "fyass"
version = "0.1.0"
authors = ["optozorax <optozorax@gmail.com>"]
edition = "2018"
[dependencies]
teloxide = { git = "https://github.com/teloxide/teloxide", branch = "dev" }
log = "0.4.8"
tokio = "0.2.11"
@optozorax
optozorax / miniquad_shader_2.rs
Last active February 24, 2020 16:29
miniquad_shader_2.rs
/*
Shader: https://www.shadertoy.com/view/3l23Rh
Post: https://t.me/optozorax_dev/62
Sorry for shitcode, this is just test
Based on `quad` example in miniquad
*/
use miniquad::*;
#[repr(C)]
@optozorax
optozorax / miniquad_shader_1.rs
Created February 24, 2020 16:05
miniquad_shader_1.rs
/*
Shader: https://www.shadertoy.com/view/4ljGRd
Post: https://t.me/optozorax_dev/62
Sorry for shitcode, this is just test
Based on `quad` example in miniquad
*/
use miniquad::*;
@optozorax
optozorax / autograd_example.rs
Last active February 23, 2020 11:00
autograd_example.rs
use autograd as ag;
use autograd::ops::*;
use ag::tensor::Tensor;
use ag::ndarray::arr0;
use ag::ops::gradient_descent_ops::SGD;
fn value(a: &Tensor<f32>) -> f32 {
a.eval(&[]).unwrap().into_raw_vec()[0]
}
@optozorax
optozorax / spiril.rs
Created February 23, 2020 07:35
spiril.rs
use spiril::unit::Unit;
use spiril::population::Population;
struct Creature {
// Структура вашего существа
}
impl Unit for Creature {
fn fitness(&self) -> f64 {
// Вычисление пригодности
@optozorax
optozorax / genetic_alg.rs
Last active February 23, 2020 07:19
genetic_alg.rs
/*
Что это такое? Читай начиная с https://t.me/optozorax_dev/46
*/
use enigo::*;
use spiril::unit::Unit;
use spiril::population::Population;
use rand::{thread_rng, Rng};
use std::process::{Command, Stdio};
@optozorax
optozorax / tampermonkey.js
Created November 6, 2019 10:03
Автоматическое переключение языка для klava.org
// ==UserScript==
// @name Автоматическое переключение языка для раскладки ergozorax
// @version 0.1
// @description Для набора текстов со смешанным языком, чтобы не тратить мыслетопливо на переключение языка.
// @author optozorax
// @match https://klava.org/keyboard*
// @grant none
// ==/UserScript==
(function() {
@optozorax
optozorax / README.md
Last active July 24, 2021 15:24
Style for kladenets
@optozorax
optozorax / main.rs
Created September 14, 2019 16:54
For with first and last element in Rust
trait Boundarized {
fn boundarize(self) -> Tripled<Self>;
}
struct Tripled<I> {
iter: I,
next: I,
}
impl<T> Boundarized for Iterator<Item = T> {