Skip to content

Instantly share code, notes, and snippets.

Avatar

Yury Pliner Pliner

View GitHub Profile
@Pliner
Pliner / makelist.sh
Created Oct 1, 2018
Combine list of networks with merge.pl and copy to tftpd
View makelist.sh
#!/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 / import
Created Oct 1, 2018
mikrotik import script
View import
: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 / merge.pl
Last active Oct 1, 2018
Merge several lists of the networks
View merge.pl
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
Last active Oct 3, 2020
Mikrotik antifilter.download update script
View import
: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 / sprache.cs
Last active Jan 7, 2016
Sprache example
View sprache.cs
using System;
using System.Linq;
using Sprache;
namespace Trash
{
public static class EntryPoint
{
public static void Main()
{
View Patch Version.cs
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];
View gist:d1d60aac2836bbe19ac8
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;
You can’t perform that action at this time.