Skip to content

Instantly share code, notes, and snippets.

View holmberd's full-sized avatar

holmberd holmberd

View GitHub Profile
@holmberd
holmberd / INSTALL
Created September 6, 2017 22:08 — forked from arya-oss/INSTALL.md
Ubuntu 16.04 Developer Tools installation
###### development tools
sudo apt-get install build-essential python-dev git nodejs-legacy npm gnome-tweak-tool openjdk-8-jdk
### Python packages
sudo apt-get install python-pip python-virtualenv python-numpy python-matplotlib
### pip packages
pip install django flask django-widget-tweaks django-ckeditor beautifulsoup4 requests classifier SymPy ipython
@holmberd
holmberd / aws-ebs-ec2-howtos.md
Last active February 21, 2024 14:04
Attaching and Mounting EBS Volume to an EC2 Instance

Attaching and Mounting EBS Volume to EC2 Instance

Create

  • Create new EBS Volume in the correct Availability Zone
  • Attach new EBS Volume to EC2 Instance

Mount

  • Check filesystem type (ext4) sudo file -s /dev/xvd*
  • Find new disk sudo fdisk -l
  • Create filesystem sudo mkfs -t ext4 /dev/xvdf
@holmberd
holmberd / nginx-ssl.md
Last active November 2, 2017 22:01
Create SSL certificate for Nginx

  • sudo mkdir /etc/nginx/ssl
  • sudo openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout /etc/nginx/ssl/nginx.key -out /etc/nginx/ssl/nginx.crt
Country Name (2 letter code) [AU]: __
State or Province Name (full name) [Some-State]: __
Locality Name (eg, city) []: __
Organization Name (eg, company) [Internet Widgits Pty Ltd]: __
Organizational Unit Name (eg, section) []: __
@holmberd
holmberd / nginx-ssl-cerbot.md
Last active November 2, 2017 22:10
Run SSL with Nginx and Certbot

Install cerbot

  • sudo add-apt-repository ppa:certbot/certbot
  • sudo apt-get update
  • sudo apt-get install python-certbot-nginx

Obtaining an SSL Certificate

  • sudo certbot --nginx -d example.com -d www.example.com

Auto-renewal

  • Installed with certbot in /etc/cron.d
@holmberd
holmberd / php-pools.md
Last active September 25, 2024 05:44
Adjusting child processes for PHP-FPM (Nginx)

Adjusting child processes for PHP-FPM (Nginx)

When setting these options consider the following:

  • How long is your average request?
  • What is the maximum number of simultaneous visitors the site(s) get?
  • How much memory on average does each child process consume?

Determine if the max_children limit has been reached.

  • sudo grep max_children /var/log/php?.?-fpm.log.1 /var/log/php?.?-fpm.log
@holmberd
holmberd / ga-cross-domain-tracking.md
Last active October 13, 2022 21:41
Google Analytics - Cross Domain Manual Link Tracking

Manually decorate a URL with the linker parameter for Google Tag Manager or Google Analytics

In the case where you manually want to decorate a link with the linker parameter, i.e. the link is not a valid anchor link, or the final tracking page is accessed by user in a non direct way: File Download, Extension Installation, ect...

Google Analytics

/**
 * Returns the Google Analytics tracker linker parameter.
@holmberd
holmberd / socks-proxy.md
Last active May 29, 2021 08:30
Configure remote SSH service and set up local SSH SOCKS proxy tunnel

REMOTE: Set up SSH service on the remote host

  • Skip if already set up, check with: sudo service ssh status
  • sudo apt-get install ssh
  • Edit ssh config file with the lines below: sudo vim /etc/ssh/sshd_config
PermitRootLogin no              #Disable direct login from root
AllowUsers user1 user2 user3    #*Only* allow this users to connect
AllowTcpForwarding yes          #Required to setup the tunnel, yes or commented out
PubkeyAuthentication yes        #Enables public key authentication
Port 22                         #Listening port of the server
@holmberd
holmberd / aws-custom-cloudwatch-metrics.md
Last active November 20, 2019 16:27
Setup AWS CloudWatch Custom EC2 Instance Metrics with SSM and CloudWatch Agent (Ubuntu)

Setup AWS CloudWatch Custom Metrics with SSM and CloudWatch Agent

  1. Create IAM Roles and Users for Use With CloudWatch Agent
  1. Make sure the AWS Systems Manager Agent is installed and running on the EC2 instance
  1. Install and configure AWS CloudWatch Agent with SSM
@holmberd
holmberd / deploy-keys.md
Last active February 11, 2024 20:36
Setup GitHub repository SSH deploy keys

Setup GitHub repository SSH deploy keys

  1. Create GitHub repository in github and save the SSH repository url

  2. Init git on server in code directory

  • git init
  1. Create SSH keys on the server
  • ssh-keygen -t rsa -b 4096 -C [email protected]
  • Rename the key that doesn't end with .pub to repo-name.deploy.pem