Skip to content

Instantly share code, notes, and snippets.

View Xitsa's full-sized avatar

Stas Bushuev Xitsa

View GitHub Profile
@Xitsa
Xitsa / ParseChaptersM4b.bat
Last active October 1, 2023 18:49
Перекодируем m4b
@echo off
SET FFPROBE=C:\WorkProg\Encoders\ffmpeg\bin\ffprobe.exe
SET JQ=C:\WorkProg\Jq\jq.exe
%FFPROBE% -print_format json -show_chapters %1 2>nul | jq -r -f ParseChaptersM4b.jq
@Xitsa
Xitsa / xLogger.cs
Created June 15, 2021 09:22
BBLogger
using System;
using System.Drawing;
using CodeKicker.BBCode;
using CodeKicker.BBCode.SyntaxTree;
namespace Xitsa
{
public static class Logger
{
static BBCodeParser GetParser()
@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 = '∅';var style = 'cursor: pointer; position: absolute;'; if (isPost) { style += 'left: -20px; font-size: 20px; top: -5px;'; } else { style += 'left: -12px
@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 / 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 / .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 / 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 / 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 / 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])))))
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)})();