Skip to content

Instantly share code, notes, and snippets.

@t0d0r
t0d0r / gista-file
Last active October 9, 2019 14:29
panels generator
require 'pp'
a = [('0001'..'9999').to_a,
('D000'..'D999').to_a,
('E000'..'E999').to_a].flatten
a.each_slice(20).each { |e|
puts e.join(",") + ','
}
@t0d0r
t0d0r / gista-file
Created June 20, 2019 08:11
debian iface generator
1.upto(24).each { |e|
ip = 190 + e
puts <<__EOF__
auto eth1:#{ip}
iface eth1:#{ip} inet static
address 192.168.1.#{ip}
netmask 255.255.255.0
__EOF__
}
@t0d0r
t0d0r / gista-file
Last active May 15, 2019 14:52
iptables.sh
# 10.0.100.2 ON <=> 94.190.187.19 added by script 2019-05-15
iptables -A DNAT187 -d 94.190.187.19 -j DNAT --to-destination 10.0.100.2
iptables -A SNAT00 -s 10.0.100.2 -j SNAT --to-source 94.190.187.19
# 10.0.100.204 ON <=> 94.190.180.109 added by script 2019-05-15
iptables -A DNAT180 -d 94.190.180.109 -j DNAT --to-destination 10.0.100.204
iptables -A SNAT00 -s 10.0.100.204 -j SNAT --to-source 94.190.180.109
# 10.0.110.57 ON <=> 94.190.180.235 added by script 2019-05-15
iptables -A DNAT180 -d 94.190.180.235 -j DNAT --to-destination 10.0.110.57
@t0d0r
t0d0r / gista-file
Last active May 15, 2019 14:49
iptables
data =<<__EOF__
10.0.100.2 94.190.187.19 ON
10.0.100.204 94.190.180.109 ON
10.0.110.57 94.190.180.235 ON
10.0.110.58 94.190.180.121 ON
10.0.110.73 94.190.180.42 ON
10.0.150.100 94.190.179.142 ON
10.0.199.197 94.190.181.7 ON
10.0.20.198 94.190.181.165 ON
10.0.200.173 94.190.179.130 ON
@t0d0r
t0d0r / gista-file
Last active January 4, 2020 14:28
divident
# vim:filetype=ruby
p = 1641.23
p = 1914.77
cd = (p * ( 10.00/100 ))
dd = ((p-cd)*( 5.00/100 ))
cash = p - cd - dd
puts "=" * 60
puts ("%8.2f - %8.2f - %8.2f = %8.2f" % [ p, cd, dd, cash ]).center(60).rstrip
puts ("%8s - %8s - %8s = %8s" % %w(сума печалба дивидент крайна) ).center(60).rstrip
puts ("%8s - %8s - %8s = %8s" % %w(сума 10% 5% крайна) ).center(60).rstrip
@t0d0r
t0d0r / gist:395e4d4d9fce9f8be8a7a77490158fad
Created January 9, 2019 12:22 — forked from pitch-gist/gist:2999707
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@t0d0r
t0d0r / haproxy_rate_limiting.md
Created December 22, 2018 20:10 — forked from procrastinatio/haproxy_rate_limiting.md
Rate limiting with HAproxy

Introduction

So HAProxy is primalery a load balancer an proxy for TCP and HTTP. But it may act as a traffic regulator. It may also be used as a protection against DDoS and service abuse, by maintening a wide variety of statistics (IP, URL, cookie) and when abuse is happening, action as denying, redirecting to other backend may undertaken ([haproxy ddos config], [haproxy ddos])

@t0d0r
t0d0r / gista-file
Created September 12, 2017 09:04
cloudstrap
data = <<__EOF__
node-bg-os 127.0.0.1 127.0.0.1
__EOF__
require 'net/ssh'
exit if ARGV[0].nil?
count = 0
data.split(/\n/).each do |line|
@t0d0r
t0d0r / gista-file
Created August 3, 2017 17:08
24ins.domains.check.rb
domains = %w(
beeehappy.eu
gb-scaf.bg
jambo24.bg
knijka.bg
lammen.bg
onebeerwith.me
silvercourt.bg
varna-easytransfer.com
varna-easytransfer.ru)
@t0d0r
t0d0r / gista-file
Created August 3, 2017 16:34
24ins.domains.dns.fix
=> beeehappy.eu
beeehappy.eu has address 139.162.131.252
beeehappy.eu mail is handled by 0 mail.beeehappy.eu.
beeehappy.eu. 299 IN TXT "v=spf1 +a +mx +ip4:139.162.131.252 +ip4:91.215.216.43 +ip4:91.215.218.156 ~all"
mail.beeehappy.eu has address 91.215.218.156
=> gb-scaf.bg
gb-scaf.bg has address 139.162.131.252
gb-scaf.bg mail is handled by 0 mail.gb-scaf.bg.
gb-scaf.bg. 14399 IN TXT "v=spf1 +a +mx +ip4:139.162.131.252 +ip4:91.215.216.43 +ip4:91.215.218.156 ~all"
mail.gb-scaf.bg has address 91.215.218.156