Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am adautoneto on github.
  • I am adauto (https://keybase.io/adauto) on keybase.
  • I have a public key whose fingerprint is 429B 4BB8 1C51 2E0C FB64 7CEE F340 EA1E 20AE 6193

To claim this, I am signing this object:

@adautoneto
adautoneto / multiple_backends.vcl
Created November 28, 2018 15:37
Varnish grace period for when server is down
vcl 4.0;
import directors;
backend server_1 {
.host = "172.30.0.125";
.port = "81";
}
backend server_2 {
grunt.registerTask('check_frontend_files', function () {
require('./tasks/check_frontend_files.js')(grunt);
});
time curl -I $1
#!/bin/bash
CURL="/usr/bin/curl"
GAWK="/usr/bin/gawk"
result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $1`
echo " Time_Connect Time_startTransfer Time_total "
echo $result | $GAWK -F: '{ print $1" "$2" "$3}'
[
{
"title": "Aproveite 50% OFF em toda a loja!",
"description": "Aproveite para comprar na Amazon economizando 50% em qualquer produto.",
"store": {
"name": "Amazon",
"image": "amazoncom.jpg"
}
},
{
$(function() {
$("[data-plan]").each(function(i, item) {
var $item = $(item),
table = $item.parents("table"),
tableRows = table.find("tr"),
templateRow = tableRows.last().clone(),
columnIndex = $item.siblings().andSelf().index($item),
currentRowIndex = tableRows.index($item.parents("tr")) + 1;
var produtos = conteudo[ $item.data("plan") ];
namespace Interreg.Integration.Web.Routing{
using Extensions;
using Interreg.Web.Controllers;
using Xunit;
public class ApplicationsFacts:Base{
[Fact]
public void Application(){
"~/Applications/1"
.ShouldMapTo<ApplicationsController>(c=>c.Application(null,null));
}
@adautoneto
adautoneto / block_ipaddr_failaudit.ps1
Created June 26, 2013 19:12
Blocks all IPs that failed to login after 20 attempts
$DT = [DateTime]::Now.AddDays(-1) # check only last 24 hours
$l = Get-EventLog -LogName 'Security' -InstanceId 4625 -After $DT | Select-Object @{n='IpAddress';e={$_.ReplacementStrings[-2]} } # select Ip addresses that has audit failure
$g = $l | group-object -property IpAddress | where {$_.Count -gt 20} | Select -property Name # get ip adresses, that have more than 20 wrong logins
$fw = New-Object -ComObject hnetcfg.fwpolicy2 # get firewall object
$ar = $fw.rules | where {$_.name -eq 'BlockAttackers'} # get firewall rule named 'BlockAttackers' (must be created manually)
$arRemote = $ar.RemoteAddresses -split(',') #split the existing IPs into an array so we can easily search for existing IPs
require 'rubygems'
require 'erb'
require 'fileutils'
require 'find'
require 'rake'
require 'rake/tasklib'
task :default do
package_location="sample/" # website folder location relative to checkout root
project_file = "sample/sample.csproj" # website project location relative to checkout root