Skip to content

Instantly share code, notes, and snippets.

View georgepaoli's full-sized avatar

George Paoli georgepaoli

View GitHub Profile
@georgepaoli
georgepaoli / README.md
Last active February 22, 2019 17:03
Install SAP GUI for Java in Linux

Instructions

Download .ZIP from SAP using your partner credentials

https://launchpad.support.sap.com/#/softwarecenter/template/products/_APP=00200682500000001943&_EVENT=NEXT&HEADER=Y&FUNCTIONBAR=Y&EVENT=TREE&NE=NAVIGATE&ENR=01200245450100000474&V=INST&TA=ACTUAL/SAP%20GUI%20FOR%20JAVA

Extract 50144807_7.zip

cd <folder extract>/BD_NW_7.0_Presentation_7.50_Comp._2_/PRES2/GUI/JAVA

Install by Wizard

@georgepaoli
georgepaoli / README.md
Last active February 7, 2019 13:21
Install Eclipse in Linux

Download

https://www.eclipse.org/downloads/download.php?file=/oomph/epp/2018-12/R/eclipse-inst-linux64.tar.gz

Extract

sudo tar -xvzf ~/Downloads/eclipse-inst-linux64.tar.gz
cd eclipse-installer/

Open Installer

@georgepaoli
georgepaoli / README.md
Last active March 16, 2025 19:10
Install SAP GUI in Windows 10

Instructions

Download .ZIP from SAP using your partner credentials

https://launchpad.support.sap.com/#/softwarecenter/template/products/_APP=00200682500000001943&_EVENT=NEXT&HEADER=Y&FUNCTIONBAR=Y&EVENT=TREE&NE=NAVIGATE&ENR=01200245450100000473&V=INST&TA=ACTUAL/SAP%20GUI%20FOR%20WINDOWS

Extract 50144807_6.zip and execute (install all options)

PRES1\GUI\WINDOWS\Win32\SetupAll.exe

Install last patch (current gui750_09_1-80001468.exe)

@georgepaoli
georgepaoli / DictionaryProxy.cs
Created December 20, 2019 20:14
Safe way for get using Dictonary
public class DictionaryProxy<TKey, TValue>: Dictionary<TKey, TValue>
{
private Dictionary<TKey, TValue> _data;
public DictionaryProxy(Dictionary<TKey, TValue> data = null)
{
_data = data ?? new Dictionary<TKey, TValue>();
}
public TValue this[TKey key]
@georgepaoli
georgepaoli / stpVerifica_Locks.sql
Created April 10, 2020 21:02
Identificar Lock no MSSQL
-- Fonte: https://www.dirceuresende.com/blog/sql-server-como-identificar-locks-blocks-e-sessoes-bloqueadoras/
IF (OBJECT_ID('dbo.stpVerifica_Locks') IS NULL) EXEC('CREATE PROCEDURE stpVerifica_Locks AS SELECT 1')
GO
ALTER PROCEDURE [dbo].[stpVerifica_Locks]
AS
BEGIN
SET NOCOUNT ON
@georgepaoli
georgepaoli / Database sizes in MSSQL.sql
Created April 10, 2020 21:05
Tamanho dos bancos no SQL Server
-- Fonte: https://www.c-sharpcorner.com/blogs/check-database-size-in-sql-server1
SELECT sys.databases.name,
CONVERT(VARCHAR,SUM(size)*8/1024)+' MB' AS [Total disk space]
FROM sys.databases
JOIN sys.master_files
ON sys.databases.database_id=sys.master_files.database_id
GROUP BY sys.databases.name
ORDER BY sys.databases.name
@georgepaoli
georgepaoli / table sizes in MSSQL.sql
Created April 10, 2020 21:08
Tamanho das tabelas no MSSQL
-- Fonte: https://stackoverflow.com/a/7892349/2076784
SELECT
t.NAME AS TableName,
s.Name AS SchemaName,
p.rows,
SUM(a.total_pages) * 8 AS TotalSpaceKB,
CAST(ROUND(((SUM(a.total_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS TotalSpaceMB,
SUM(a.used_pages) * 8 AS UsedSpaceKB,
CAST(ROUND(((SUM(a.used_pages) * 8) / 1024.00), 2) AS NUMERIC(36, 2)) AS UsedSpaceMB,
(SUM(a.total_pages) - SUM(a.used_pages)) * 8 AS UnusedSpaceKB,
@georgepaoli
georgepaoli / Dicas Powershell.ps1
Created April 24, 2020 00:56
Comando uteis no Powershell
# clear IIS requestLimits
Get-IISConfigSection "system.webServer/security/requestFiltering" -CommitPath "Default Web Site" | Get-IISConfigElement -ChildElementName 'requestLimits' | Remove-IISConfigElement -Confirm:$false
# change IIS requestLimits
$requestFiltering = Get-IISConfigSection -CommitPath 'Default Web Site' -SectionPath 'system.webServer/security/requestFiltering'
$requestLimits = Get-IISConfigElement -ConfigElement $requestFiltering -ChildElementName 'requestLimits'
Set-IISConfigAttributeValue -ConfigElement $requestLimits -AttributeName "maxAllowedContentLength" -AttributeValue 209715200
# change IIS requestLimits by xml
$file = 'C:\inetpub\wwwroot\web.config'
@georgepaoli
georgepaoli / nginx-lua-get-token-body-json.conf
Created May 11, 2020 19:27
Get json field in body request using Lua in NGINX
server {
listen 80;
server_name localhost;
location / {
default_type application/json;
access_by_lua_block {
ngx.req.read_body()
local cjson = require "cjson"
local body = cjson.decode(ngx.req.get_body_data())
@georgepaoli
georgepaoli / detach_ec2_from_asg.py
Created November 5, 2020 02:06
Detach EC2 from ASG for SPOT interruptions events
import boto3
def lambda_handler(event, context):
instanceId = event['detail']['instance-id']
asgName = 'xxx'
ec2client = boto3.client('ec2')
describeTags = ec2client.describe_tags(Filters=[{'Name': 'resource-id','Values':[instanceId]}])
for tag in describeTags['Tags']:
if tag['Key'] == 'aws:autoscaling:groupName':
asgName = tag['Value']