Skip to content

Instantly share code, notes, and snippets.

View leonkyr's full-sized avatar
🎯
Focus

Leo Kyrpychenko leonkyr

🎯
Focus
View GitHub Profile
@leonkyr
leonkyr / README.md
Created September 26, 2016 22:43 — forked from dvdsmpsn/README.md
Google Analytics Setup for Atlassian Cloud Add-Ons

Google Analytics Setup for Atlassian Cloud Add-Ons

Add analytics.js to your add-on pages. Update the tracking code and Add-On / Macro Name and you should be good to go.

Custom Dimensions

You'll need to add some custom dimensions in Google Analytics. Use the names in comments in the section of analytics.js below // Add into custom dimensions

Personally Identifiable Information (PII)

Note that you must not store PII such as user_id which is sent over to Google Analytics in every request as a request parameter. Note userKey is not PII, so can be used.

# Global configurations
global
log 127.0.0.1 local0 notice
maxconn 200000
user haproxy
group haproxy
# nbproc 4 # Amount of processes that HAProxy will have
# spread-checks 4
# tune.bufsize 16384
# tune.maxrewrite 1024
@leonkyr
leonkyr / Prepare the environment to build Squid (Ubuntu)
Last active September 24, 2016 12:22
Prepare the environment to build Squid (Ubuntu)
sudo apt-get install build-essential
sudo apt-get install autoconf g++ python2.7-dev
@leonkyr
leonkyr / Download source code for Squid
Created April 29, 2015 19:13
Download source code for Squid
cd ~
mkdir squid
cd squid
wget http://www.squid-cache.org/Versions/v3/3.5/squid-3.5.3.tar.gz
tar xvzf squid-3.5.3.tar.gz
@leonkyr
leonkyr / Create SSL Cache folder and change permissions
Created April 29, 2015 19:11
Create SSL Cache folder and change permissions
sudo mkdir -p /usr/local/squid/var/lib/ssl_db
sudo /usr/local/squid/libexec/ssl_crtd -c -s /usr/local/var/lib/ssl_db
sudo chown nobody:nobody -R /usr/local/squid/var/lib/ssl_db
@leonkyr
leonkyr / Generate the certificate for client Browsers
Created April 29, 2015 19:10
Generate the certificate for client Browsers
cd /usr/local/squid/ssl_cert
openssl x509 -in myCA.pem -outform DER -out myCA.der
cp myCA.der ~/myCA.der
# sftp vagrant@test
# get ~/myCA.der
@leonkyr
leonkyr / Generate SSL cert for squid
Created April 29, 2015 19:08
Generate SSL for Squid
cd /usr/local/squid
sudo mkdir ssl_cert
sudo chown nobody:nobody
chmod 700 ssl_cert
cd ssl_cert
openssl req -new -newkey rsa:2048 -sha256 -days 365 -nodes -x509 -keyout myCA.pem -out myCA.pem
@leonkyr
leonkyr / Squid.conf
Created April 29, 2015 19:06
Squid.conf for SSL sniffing
#
# Recommended minimum configuration:
#
sslproxy_capath /etc/opt/csw/ssl/certs
#cache_effective_user root
# Example rule allowing access from your local networks.
# Adapt to list your (internal) IP networks from where browsing
# should be allowed
acl localnet src 10.0.0.0/8 # RFC1918 possible internal network
acl localnet src 172.16.0.0/12 # RFC1918 possible internal network
@leonkyr
leonkyr / CORS.Demo.WebApiConfig.cs
Last active August 29, 2015 14:18
CORS Demo WebApiConfig.cs
/// <summary>
/// Registers the specified configuration.
/// </summary>
/// <param name="config">The configuration.</param>
public static void Register(HttpConfiguration config)
{
// This should be before call of MapHttpAttributeRoutes()
config.EnableCors();
ConfigureDependencyResolver(config);
@leonkyr
leonkyr / Cors.demo.controller.cs
Created April 10, 2015 21:06
CORS Demo Controller
using System;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using System.Web.Http.Cors;
namespace LeonKyr.Demo.Api.Controllers
{
[EnableCors("*", "*", "*")]