This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* User: Ivan Gonzalez / Colegatron | |
* Date: 18/07/13 | |
* Time: 16:14 | |
*/ | |
header('Content-Type: application/json'); | |
$lat = $_GET["lat"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
((?# date)\d{4}\-\d{2}\-\d{2}\s+)((?# time)\d{2}\:\d{2}\:\d{2}\s+)((?# s-sitename).+?\s+)((?# s-computername).+?\s+)((?# s-ip)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s+)((?# cs-method).+?\s+)((?# cs-uri-stem).+?\s+)((?# cs-uri-query).+?\s+)((?# s-port)\d{1,3}\s+)((?# cs-username).+?\s+)((?# c-ip)\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s+)((?# cs-version)(HTTP\/\d\.\d)|\-\s+)((?# csUser-Agent).+?\s+)((?# csCookie).+?\s+)((?# csReferer).+)((?# cs-host).+?\s+)((?# sc-status)\d{1,3}\s+)((?# sc-substatus)\d{1,3}\s+)((?# sc-win32-status)\d+\s+)((?# sc-bytes)\d+\s+)((?# cs-bytes)\d+\s+)((?# time-taken)\d+) | |
Credits to http://weblogs.asp.net/ktegels/archive/2005/01/31/364272.aspx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Only procced with deletion if the there are at least @MINIMUM_IN_DB records for the last @NDAYS | |
DECLARE @NDAYS int = 3 -- Number of days to preserve | |
DECLARE @MININUM_IN_TABLE int = 2100000 -- Records needed in the DB for the last @NDAYS to proceed to deletion | |
DECLARE @TODELETE int = 1000 -- Delete un chunks of @TODELETE records | |
DECLARE @TOTALRECS int = ( select count(*) from intermediate where datediff(day, insertdate,getdate()) < @NDAYS ) | |
IF ( @TOTALRECS >= @MININUM_IN_TABLE ) | |
BEGIN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$folderToRemove = "Contents" | |
$rootFolder = "e:\import_logs" | |
$folders = Get-ChildItem -Recurse -Force $rootFolder -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer -eq $true) -and ( $_.Name -like $folderToRemove) } | |
foreach ($folder in $folders) { | |
write-host "Removing " $folder.FullName | |
remove-item -re -fo $folder.FullName | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
############################################################## | |
# Script : SetCartoDBMapLinkPermissions | |
# Author : Ivan Gonzalez / es.linkedin.com/in/colegatron | |
# Date : Apr 07, 2015 | |
# Description: Set Link Permissions to a table | |
############################################################## | |
# Purpose: | |
# | |
# Automate setting the permission of a table to 'LINK' | |
# I need to set it up as 'PRIVATE' previously because a bug |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# install 7-zip, curl and vim | |
# (Windows 2012 comes with .NET 4.5 out-of-the-box) | |
# Then use the EC2 tools to create a new AMI from the result, and you have a system | |
# that will execute user-data as a PowerShell script after the instance fires up! | |
# This has been tested on Windows 2012 64bits AMIs provided by Amazon (eu-west-1 ami-a1867dd6) | |
# | |
# Inject this as user-data of a Windows 2012 AMI, like this (edit the adminPassword to your needs): | |
# | |
# <powershell> | |
# Set-ExecutionPolicy Unrestricted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTID=$(curl -s http://169.254.169.254/latest/meta-data/instance-id) | |
echo "Getting instance info..." | |
aws ec2 describe-instances --instance-id $INSTID --region eu-west-1 | jq .Reservations > /tmp/descinstance.json | |
if [ $( cat /tmp/descinstance.json | jq '.[].Instances[0].NetworkInterfaces | length' ) -gt 1 ]; then | |
echo "[WARNING] Instance already has more than one ENI" | |
else | |
echo "Creating ENI..." | |
aws ec2 create-network-interface --subnet-id subnet-14416563 --description "Nic2 SaltMaster DevTest Network [$INSTID]" --groups sg-28dc214d --region eu-west-1 > /tmp/create-eni.json | |
echo "Getting ENI id..." | |
NICID=$(cat /tmp/create-eni.json | jq .NetworkInterface.NetworkInterfaceId | sed "s/\"//g") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* User: Ivan Gonzalez / Colegatron | |
* Date: 18/07/13 | |
* Time: 16:14 | |
*/ | |
header('Content-Type: application/json'); | |
$lat = $_GET["lat"]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is an update of the Russel's state to use it basically as mail forwarder in auto scaled environments. | |
The tipycal problem is that if you get notification emails from "webserver@mydomain.com" in an environment where you really have 5 or 6 webservers for the same application, it is difficult to track back the issue to the right server. | |
I have solved it renaming the server and the headers: | |
All the emails sent from the server for <myhostname>.domain.com will renamed to <senderuser>@<myhostname-my-ipv4>.domain.com. | |
Also adds a header replacement to avoid problems with Office365 mail servers, which rejects to send emails with different names on the hostname and the email headers | |
Original job: http://russell.ballestrini.net/postfix-salt-state-formula/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Whenever is possible, try to do not install anything on your desktop. | |
Use virtualbox. | |
Better, use Docker. | |
Don't feel bad. I have lots of shit installed in my desktop too. | |
------ | |
On source machine: |
OlderNewer