Skip to content

Instantly share code, notes, and snippets.

View egormkn's full-sized avatar

Egor Makarenko egormkn

View GitHub Profile
@egormkn
egormkn / foxxll_io_test.cpp
Created February 18, 2018 21:26
FOXXLL async IO test
#include <iostream>
#include <vector>
#include <omp.h>
#include <foxxll/io/request.hpp>
#include <foxxll/io/create_file.hpp>
#include <foxxll/io/request_operations.hpp>
#include <foxxll/common/aligned_alloc.hpp>
@egormkn
egormkn / firewall.bat
Last active December 2, 2018 08:49
iptables script
@echo off
echo "Enable firewall autostart"
sc config SharedAccess start= auto
echo "Start firewall service"
sc start SharedAccess
echo "Enable Windows Firewall"
netsh firewall set opmode mode= ENABLE
#include "mat.h" // from MATLAB
#include "matrix.h" // from MATLAB
#include "matio.h" // https://github.com/tbeu/matio
#include "string.h"
#include "stdlib.h"
/*
* Open a MAT-file "filename" using mode "mode". Return
* a pointer to a MATFile for use with other MAT API functions.
echo -n > /etc/environment
sed -i 's/#\(baseurl=.*\)mirror\.centos\.org/\1vault.centos.org/g' /etc/yum.repos.d/CentOS-*.repo
sed -i 's/\(mirrorlist=\)/#\1/g' /etc/yum.repos.d/CentOS-*.repo
yum clean all
START TRANSACTION
SELECT * FROM current_schema()
SELECT * FROM "information_schema"."tables" WHERE ("table_schema" = 'public' AND "table_name" = 'artist_credit') OR ("table_schema" = 'public' AND "table_name" = 'artist_credit_name') OR ("table_schema" = 'public' AND "table_name" = 'artist_image') OR ("table_schema" = 'public' AND "table_name" = 'release_type') OR ("table_schema" ='public' AND "table_name" = 'tag') OR ("table_schema" = 'public' AND "table_name" = 'language') OR ("table_schema" = 'public' AND "table_name" = 'work') OR ("table_schema" = 'public' AND "table_name" = 'recording') OR ("table_schema" = 'public' AND "table_name" = 'track') OR ("table_schema" = 'public' AND "table_name" = 'release') OR ("table_schema" = 'public' AND "table_name" = 'label') OR ("table_schema" = 'public' AND "table_name" = 'country') OR ("table_schema" = 'public' AND "table_name" = 'membership') OR ("table_schema" = 'public' AND "table_name" = 'artist') OR ("table_schema" = 'public' AND "table_name" = 'artist_alias') OR
@egormkn
egormkn / trigger.plsql
Last active January 19, 2019 23:04
Trigger
CREATE OR REPLACE FUNCTION check_group() RETURNS TRIGGER AS
$BODY$
DECLARE
group_count integer;
musician_count integer;
BEGIN
SELECT COUNT(*) FROM artist
WHERE artist.id = NEW."groupId" AND is_group = TRUE
LIMIT 1
INTO group_count;
@egormkn
egormkn / yeast6_cycles.log
Last active October 18, 2019 16:05
Statistics for cycles in yeast6 metabolic model
/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java -javaagent:/home/egor/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/lib/idea_rt.jar=44289:/home/egor/.local/share/JetBrains/Toolbox/apps/IDEA-U/ch-0/192.6817.14/bin -Dfile.encoding=UTF-8 -classpath /home/egor/Documents/Bioinformatics/Bachelor/solver/target/classes:/home/egor/.m2/repository/com/ibm/cplex/12.9.0/cplex-12.9.0.jar:/home/egor/.m2/repository/com/ibm/cplex-native/12.9.0/cplex-native-12.9.0.jar:/home/egor/.m2/repository/org/sbml/libsbml/5.16.0/libsbml-5.16.0.jar:/home/egor/.m2/repository/net/sf/jopt-simple/jopt-simple/6.0-alpha-3/jopt-simple-6.0-alpha-3.jar:/home/egor/.m2/repository/org/ejml/ejml-all/0.38/ejml-all-0.38.jar:/home/egor/.m2/repository/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar:/home/egor/.m2/repository/org/ejml/ejml-core/0.38/ejml-core-0.38.jar:/home/egor/.m2/repository/org/ejml/ejml-fdense/0.38/ejml-fdense-0.38.jar:/home/egor/.m2/repository/org/ejml/ejml-ddense/0.38/ejml-ddense-0.38.jar:/home/egor/.m2/repository/

Домашнее задание: Выражения

Разработайте классы Const, Variable, Add, Subtract, Multiply, Divide для вычисления выражений с одной переменной. Классы должны позволять составлять выражения вида

expr = Subtract(
    Multiply(
        Const(2),
        Variable("x")
@egormkn
egormkn / jupyter-lab-icon.md
Last active August 10, 2023 14:42
Running JupyterLab as a desktop application on Linux

GNOME Desktop icon for Jupyter Lab

Installation

  1. Copy jupyter-lab.desktop to ~/.local/share/applications
  2. Copy jupyter-lab.svg to ~/.local/share/icons
  3. Restart gnome-desktop session (Alt+F2 -> restart)
@egormkn
egormkn / minecraft-server-setup.sh
Last active April 9, 2022 16:20
Minecraft Server setup script
#!/bin/bash
# https://minecraft.gamepedia.com/Tutorials/Server_startup_script
# https://gist.github.com/justinjahn/4fe65b552b0622662420928cc8ffc7c0
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi