Skip to content

Instantly share code, notes, and snippets.

import java.util.ArrayList;
import java.util.List;
public class AvlTree<K extends Comparable<K>, V> {
private static class Node<K extends Comparable<K>, V> {
public K key;
public V value;
public Node left;
public Node right;
public int height;
function Patch-Version($pathToFile, $buildNumber) {
$versionFormat = "(\d+)\.(\d+)\.(\d+)\.(\d+)";
$pathToTmpFile = $pathToFile + ".tmp";
Get-Content $pathToFile | % { $_ -replace $versionFormat, ('$1.$2.' + $buildNumber + '.$4') } | Set-Content $pathToTmpFile
Move-Item $pathToTmpFile $pathToFile -force
}
Patch-Version $args[0] $args[1];
@Pliner
Pliner / sprache.cs
Last active January 7, 2016 23:49
Sprache example
using System;
using System.Linq;
using Sprache;
namespace Trash
{
public static class EntryPoint
{
public static void Main()
{
@Pliner
Pliner / import
Last active November 6, 2024 20:09
Mikrotik antifilter.download update script
:do {
:do {
/file remove "/ipsum.rsc";
/file remove "/subnet.rsc";
} on-error={}
:put "Downloading ipsum.rsc...";
:do {
/tool fetch url="https://antifilter.download/list/ipsum.rsc" dst-path="/ipsum.rsc"
} on-error={
@Pliner
Pliner / merge.pl
Last active October 1, 2018 03:58
Merge several lists of the networks
use strict;
use Net::IP;
my @ips = ();
my $result = shift @ARGV;
for(my $i = 0; $i < @ARGV; ++$i) {
open(my $in, $ARGV[$i]) or warn "Can't open $ARGV[$i]: $!";
while (!eof($in)) {
defined(my $line = readline $in) or die "readline failed for $ARGV[$i]: $!";
@Pliner
Pliner / import
Created October 1, 2018 03:58
mikrotik import script
:do {
:do {
/file remove "/total.rsc";
} on-error={}
:put "Downloading total.rsc...";
:do {
/tool fetch address=/*address*/ src-path=total.rsc dst-path="/total.rsc" mode=tftp keep-result=yes
} on-error={
:put "Error. Download failed";
@Pliner
Pliner / makelist.sh
Created October 1, 2018 04:04
Combine list of networks with merge.pl and copy to tftpd
#!/bin/bash
cd /root/blacklist
wget -N https://antifilter.download/list/ipsum.lst https://antifilter.download/list/subnet.lst;
./merge.pl total.lst ipsum.lst subnet.lst;
cat total.lst | sed 's/\(^\)/\/ip firewall address-list add list=rkn address=/g' > total.rsc;
cp total.rsc /var/lib/tftpboot/;
logger "total.rsc was updated";
@Pliner
Pliner / docker-compose.yml
Last active October 8, 2022 15:55
Runs 5 nodes rabbitmq cluster locally in docker-compose
services:
rabbit_1: &rmq
image: rabbitmq:management
hostname: rabbit_1
ports:
- "15673:15672"
- "5673:5672"
environment:
- RABBITMQ_ERLANG_COOKIE='mysecret'
healthcheck: