Skip to content

Instantly share code, notes, and snippets.

View Xitsa's full-sized avatar

Stas Bushuev Xitsa

View GitHub Profile
Singing in all the languages they know, one by one
Praising everything they love
little birds
We are the Klingon Empire
We consist of several dozen systems
and we are spreading our influence every day
Could your world be next?
Why not?
Come, join the adventure!
As a Klingon tributary world
@Xitsa
Xitsa / mm.mod
Created October 10, 2016 13:51
Задачка про титанов и пр. по HM&M 3
\* plan.lp *\
Maximize
value: 300 titan + 120 naga + 60 jinn + 40 mag + 35 golem + 20 gorg + 4 grem
Subject To
monetoj: 5000 titan + 1500 naga + 750 jinn + 500 mag + 400 golem + 200 gorg + 70 grem - 500 gem <= 200000
gemoj: 3 titan + 2 naga + 1 jinn + 1 mag + 1 gem <= 115
rtuto: 1 titan + 1 jinn + 1 mag + 1 golem <= 80
fara: 300 titan + 40 mag + 4 grem >= 4000
javascript:(function(){var a=window,b=document,c=encodeURIComponent,d=a.open("https://www.google.com/bookmarks/mark?op=edit&output=popup&bkmk="+c(b.location)+"&title="+c(b.title),"bkmk_popup","left="+((a.screenX||a.screenLeft)+10)+",top="+((a.screenY||a.screenTop)+10)+",height=510px,width=550px,resizable=1,alwaysRaised=1");a.setTimeout(function(){d.focus()},300)})();
@Xitsa
Xitsa / e.cxx
Created May 25, 2017 06:33
Simple model to analyze hash table characteristics
// To compile use this command
// g++ -std=c++11 e.cxx && ./a.out
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <random>
#include <cmath>
#define COUNT_OF(x) ((sizeof(x)/sizeof(0[x])) / ((size_t)(!(sizeof(x) % sizeof(0[x])))))
@Xitsa
Xitsa / array_shift.cxx
Created August 15, 2017 04:15
Simple program for testing recursive algorithm of array shift
#include <stdio.h>
#include <cassert>
#include <memory>
// compile as g++ --std=c++11 e.cxx
// Array size
const size_t N = 35;
// print [left, right]
@Xitsa
Xitsa / nokto.bat
Last active May 11, 2020 09:41
Skemo de la dua ekzekuto
C:\WorkProg\Graphviz\bin\neato.exe -Tpng nokto_2.gv -o nokto_2n.png
C:\WorkProg\Graphviz\bin\neato.exe -Tsvg nokto_2.gv -o nokto_2n.svg
xconvert -density 300 nokto_2n.svg nokto_2n_300.png
@Xitsa
Xitsa / .gitconfig
Last active January 27, 2021 10:50
Интеграция git и fzf
[alias]
xdiff = "!f() { \
git diff "$@" $(git ls-files --modified --exclude-standard | fzf -m); \
}; f"
xadd = "!f() { \
git add "$@" $(git ls-files --modified --others --exclude-standard | fzf -m); \
}; f"
@Xitsa
Xitsa / ipsec.lua
Last active September 7, 2020 11:40
Плагин для Wireshark, который расшифровывает мандатные метки согласно ГОСТ Р 58256-2018 (а-ля астралинукс)
--[[
--Для установки надо открыть в wireshark’е меню Help/About
--Там найти вкладку Folders, скопировать путь к ‘Personal Lua Plugins’
--Создать этот каталог, если надо
--Скопировать туда этот файл и перезапустить wireshark
--]]
local function pack_byte(mask, byte, offset)
local limited_byte = bit32.band(byte, 0xFF)
local low_pos = 8 - math.floor(offset / 8)
local high_pos = low_pos - 1
@Xitsa
Xitsa / params.xml
Created September 7, 2020 11:41
Генератор RPC-вызовов на gsl.
<?xml version = "1.0"?>
<rpc
script = "typedefines.gsl"
module = "Trafficd"
>
<types>
<type kind="enum" name="ServiceId">
<doc>Сервисы</doc>
<elem name="telnet"/>
<elem name="ssh"/>
@Xitsa
Xitsa / vote-reset.js
Created January 15, 2021 08:00
Vote reset bookmark
javascript:(function() { if (document.querySelector('.vote_reset_button')) { console.error('Lepra vote reset buttons already there on this page'); return; } var divs = document.querySelectorAll('.vote'); var sid = null; var uid = null;if (document.cookie.match(/uid=([0-9]+)(;|$)/)) { uid = RegExp.$1; } if (document.cookie.match(/sid=(.+?)(;|$)/)) { sid = RegExp.$1; } if (!sid || !uid) { return false; }[].forEach.call(divs, function(div) { var idAttr = div.getAttribute('id'); var id = null; var isPost = false; if (idAttr) { if (idAttr.match(/js-post_id_([0-9]+)/)) { id = RegExp.$1; isPost = true; } } else { var voteButton = div.querySelector('.vote_button'); if (voteButton.getAttribute('onclick').match(/voteHandler.vote\('([0-9]+)',/)) { id = RegExp.$1; } } if (!id) { return false; } var resetButton = document.createElement('a'); resetButton.innerHTML = '&#8709;';var style = 'cursor: pointer; position: absolute;'; if (isPost) { style += 'left: -20px; font-size: 20px; top: -5px;'; } else { style += 'left: -12px