- Windows:
ssh-keygen -o -t rsa -b 4096 -C "[email protected]"
notepad C:\Users\usuario\.ssh\id_rsa
| public static class EnvHelper | |
| { | |
| public static string ENV_VAR_A => GetEnvVar(); | |
| public static string ENV_VAR_B => GetEnvVar(); | |
| public static string ENV_VAR_C => GetEnvVar(); | |
| private static string GetEnvVar([CallerMemberName] string name = null) | |
| => Environment.GetEnvironmentVariable(name); | |
| } |
ssh-keygen -o -t rsa -b 4096 -C "[email protected]"
notepad C:\Users\usuario\.ssh\id_rsa
| CREATE TABLE "PersistedGrants" | |
| ( | |
| "Key" varchar(200) NOT NULL, | |
| "Type" varchar(50) NOT NULL, | |
| "SubjectId" varchar(200), | |
| "SessionId" varchar(100), | |
| "ClientId" varchar(200) NOT NULL, | |
| "Description" varchar(200), | |
| "CreationTime" datetime NOT NULL, | |
| "Expiration" datetime, |
| 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'] | |
| 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()) |
| # 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' |
| -- 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, |
| -- 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 |
| -- 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 |
| 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] |