Skip to content

Instantly share code, notes, and snippets.

View xLogger.cs
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 Jan 15, 2021
Vote reset bookmark
View vote-reset.js
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 Sep 7, 2020
Генератор RPC-вызовов на gsl.
View params.xml
<?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 Sep 7, 2020
Плагин для Wireshark, который расшифровывает мандатные метки согласно ГОСТ Р 58256-2018 (а-ля астралинукс)
View ipsec.lua
--[[
--Для установки надо открыть в 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 Jan 27, 2021
Интеграция git и fzf
View .gitconfig
[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
Skemo de la dua ekzekuto
View nokto.bat
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 Aug 15, 2017
Simple program for testing recursive algorithm of array shift
View array_shift.cxx
#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
Simple model to analyze hash table characteristics
View e.cxx
// 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])))))
View Google Bookmarks.js
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 / mm.mod
Created Oct 10, 2016
Задачка про титанов и пр. по HM&M 3
View mm.mod
\* 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