Skip to content

Instantly share code, notes, and snippets.

View spy86's full-sized avatar
🎯
Focusing

Maciej Michalski spy86

🎯
Focusing
View GitHub Profile
@spy86
spy86 / web.config
Created January 21, 2019 19:47
Additional config for Sonarqube
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxQueryString="3000" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
@spy86
spy86 / kill-process.sh
Created January 21, 2019 20:01
For loop to kill all process
#!/bin/bash
for i in `ps -ax | grep httpd | awk '{print $1}'`; do kill -9 $i; done;
@spy86
spy86 / proxy.conf
Created January 21, 2019 20:14
Sample apache proxy configurations
<VirtualHost myhost:80>
ServerName myhost
DocumentRoot /path/to/myapp/public
ProxyPass / http://myapp:8080/
ProxyPassReverse / http://myapp:8080/
</VirtualHost>
@spy86
spy86 / NginxTCPLoadBalancing.conf
Created January 21, 2019 20:18
NGINX TCP Load Balancing
stream {
upstream mysql_read {
server read1.example.com:3306 weight=5;
server read2.example.com:3306;
server 10.10.12.34:3306 backup;
}
server {
listen 3306;
proxy_pass mysql_read;
}
@spy86
spy86 / NginxTCPLoadBalancingOn2Servers.conf
Created January 21, 2019 20:19
NGINX HTTP Load Balancing between two or more HTTP servers.
upstream backend {
server 10.10.12.45:80 weight=1;
server app.example.com:80 weight=2;
}
server {
location / {
proxy_pass http://backend;
}
}
@spy86
spy86 / NginxProxy.conf
Created January 21, 2019 20:21
NGINX ProxyPassReverse
server {
listen myhost:80;
server_name myhost;
location / {
root /path/to/myapp/public;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://myapp:8080;
}
@spy86
spy86 / SQLInstall.ps1
Created January 21, 2019 20:25
Powershell script to install MSSQL
Configuration SQLInstall
{
param (
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[String]
$PackagePath,
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
@spy86
spy86 / DSC.ps1
Created January 21, 2019 20:26
DSC config script:
#$configData = @{
@{
AllNodes = @(
@{
NodeName = "*"
PSDscAllowPlainTextPassword = $true
},
@{
NodeName = "fabfiberserver"
@spy86
spy86 / export-config.sql
Created January 21, 2019 20:44
Script to export the configuration of SQL Server
USE master
GO
PRINT β€˜*******************************************************************************************’
PRINT β€˜*******************************************************************************************’
PRINT β€˜<SQL Server Instance Name>’
SELECT @@SERVERNAME
GO
PRINT β€˜*******************************************************************************************’
PRINT β€˜*******************************************************************************************’
PRINT β€˜<SQL Server Version, Edition and Build>’
@spy86
spy86 / DB-Offline.sql
Created January 21, 2019 20:46
How to offline db on mssql 2008
ALTER DATABASE mydb SET SINGLE_USER WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE mydb SET MULTI_USER WITH ROLLBACK IMMEDIATE;
GO
ALTER DATABASE mydb SET OFFLINE WITH ROLLBACK IMMEDIATE
GO
ALTER DATABASE mydb SET ONLINE WITH ROLLBACK IMMEDIATE
GO