Skip to content

Instantly share code, notes, and snippets.

@techyboy
techyboy / Ansible Let's Encrypt Nginx setup
Created February 12, 2024 15:47 — forked from mattiaslundberg/Ansible Let's Encrypt Nginx setup
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@techyboy
techyboy / gist:3a5986c45ca54bf4bea70a4d3e343915
Created February 3, 2024 15:28
MYSQL Query History and Logs Details/Location
##If general mysql logging is enabled then we can check the queries in the log file or table based what we have mentioned in the config. Check what is enabled with the following command
mysql> show variables like 'general_log%';
mysql> show variables like 'log_output%';
##If we need query history in table then
Execute SET GLOBAL log_output = 'TABLE';
Execute SET GLOBAL general_log = 'ON';
@techyboy
techyboy / resize-root-partition
Last active December 6, 2020 01:34 — forked from troyfontaine/readme.md
Resize root partition (or how to remove the default /home partition) on CentOS 7 online
# Resize root partition (or how to remove the default /home partition) on CentOS 7 online
This requires you to be able to ssh into the instance using the root user account and that no services be running as users out of /home on the target machine.
The examples are from a default installation with no customation-you NEED to know what you're working with for volumes/partitions to not horribly break things.
By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: `/`,`/home` and
## Step 1 - Copy /home Contents
To backup the contents of /home, do the following:
```bash
@techyboy
techyboy / install nodejs, npm and gulp
Created March 10, 2018 06:48 — forked from luisfc/install nodejs, npm and gulp
Install nodejs, npm and gulp ubuntu 16.04
sudo apt-get update
sudo apt-get install nodejs
sudo apt-get install npm
## Use n module from npm in order to upgrade node
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
@techyboy
techyboy / gist:e5ae88cfd64bcb2f6eeeb4086fb2133f
Created March 9, 2018 20:31
UserData for CodeDeployAgent
#!/bin/bash
sudo apt-get update -y
sudo apt-get install python-pip -y
sudo apt-get install ruby -y
sudo apt-get install wget -y
wget https://aws-codedeploy-us-east-1.s3.amazonaws.com/latest/install
apt-add-repository ppa:brightbox/ruby-ng -y
apt-get update
apt-get install ruby2.2 ruby2.2-dev -y
chmod +x ./install
@techyboy
techyboy / gist:e829bd9c6929d79715f335b201378989
Created February 24, 2018 06:15 — forked from mikepfeiffer/gist:a4ce6d25ae092f1a4ea97afad5879530
EC2 user data script to boostrap Windows instance with Python and AWS CLI
<powershell>
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco install python -y
(new-object net.webclient).DownloadFile('https://s3.amazonaws.com/aws-cli/AWSCLI64.msi','c:\AWSCLI64.msi')
msiexec.exe /i 'C:\AWSCLI64.msi' /qn
</powershell>
@techyboy
techyboy / installchrome.ps1
Last active September 8, 2017 18:00
Install Chrome from PowerShell One Line Command
$LocalTempDir = $env:TEMP; $ChromeInstaller = "ChromeInstaller.exe"; (new-object System.Net.WebClient).DownloadFile('http://dl.google.com/chrome/install/375.126/chrome_installer.exe', "$LocalTempDir\$ChromeInstaller"); & "$LocalTempDir\$ChromeInstaller" /silent /install; $Process2Monitor = "ChromeInstaller"; Do { $ProcessesFound = Get-Process | ?{$Process2Monitor -contains $_.Name} | Select-Object -ExpandProperty Name; If ($ProcessesFound) { "Still running: $($ProcessesFound -join ', ')" | Write-Host; Start-Sleep -Seconds 2 } else { rm "$LocalTempDir\$ChromeInstaller" -ErrorAction SilentlyContinue -Verbose } } Until (!$ProcessesFound)