Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View olen2006's full-sized avatar
🐙
https://youtu.be/TulBh6klMuU

General Zod olen2006

🐙
https://youtu.be/TulBh6klMuU
  • Solar System, Earth
View GitHub Profile
@nikhita
nikhita / update-golang.md
Last active April 20, 2024 20:38
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@lukeplausin
lukeplausin / bash_aws_jq_cheatsheet.sh
Last active January 29, 2024 10:00
AWS, JQ and bash command cheat sheet. How to query, cut and munge things in JSON generally.
# Count total EBS based storage in AWS
aws ec2 describe-volumes | jq "[.Volumes[].Size] | add"
# Count total EBS storage with a tag filter
aws ec2 describe-volumes --filters "Name=tag:Name,Values=CloudEndure Volume qjenc" | jq "[.Volumes[].Size] | add"
# Describe instances concisely
aws ec2 describe-instances | jq '[.Reservations | .[] | .Instances | .[] | {InstanceId: .InstanceId, State: .State, SubnetId: .SubnetId, VpcId: .VpcId, Name: (.Tags[]|select(.Key=="Name")|.Value)}]'
# Wait until $instance_id is running and then immediately stop it again
aws ec2 wait instance-running --instance-id $instance_id && aws ec2 stop-instances --instance-id $instance_id
# Get 10th instance in the account
#!/bin/bash
mysql_secure_installation <<EOF
y
secret
secret
y
y
y
@shapeshed
shapeshed / aws-cf-logs
Last active September 12, 2022 09:10
Fetch AWS Cloudfront Logs, decompress, combine into a single file and remove comments
#!/usr/bin/env bash
BUCKET=$1
CWD=$(pwd)
if [[ -n $1 ]]; then
aws s3 sync s3://$BUCKET/cf-logs .
cat *.gz > combined.log.gz
find $CWD ! -name 'combined.log.gz' -name '*.gz' -type f -exec rm -f {} +
gzip -d combined.log.gz
@fevangelou
fevangelou / my.cnf
Last active April 23, 2024 03:35
Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers)
# === Optimized my.cnf configuration for MySQL/MariaDB (on Ubuntu, CentOS, Almalinux etc. servers) ===
#
# by Fotis Evangelou, developer of Engintron (engintron.com)
#
# ~ Updated December 2021 ~
#
#
# The settings provided below are a starting point for a 8-16 GB RAM server with 4-8 CPU cores.
# If you have different resources available you should adjust accordingly to save CPU, RAM & disk I/O usage.
#
@wpsmith
wpsmith / Microsoft.PowerShell_profile.ps1
Created July 15, 2015 13:17
PowerShell: Profile to always launch PS as Administrator, set Aliases (ex. Notepad++), Import SharePoint Online, Azure AD, and Azure Services.
# Check if Running as Admin
$IsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
if (-not $IsAdmin)
{
if ($MyInvocation.ScriptName -ne "")
{
try
{
Write-Host "Relanuching Script as Admin"
@alastairtree
alastairtree / gist:6777218c2c7facc17282
Created July 28, 2014 14:45
grant read execute permissions to a folder via powershell
$path = "C:\Sites\Website123"
$user = "domain\user"
$acl = Get-Acl $path
$arguments = $user, "ReadAndExecute", "ContainerInherit, ObjectInherit", "None", "Allow"
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $arguments
$acl.SetAccessRule($accessRule)
@sebdah
sebdah / template.json
Created June 24, 2014 12:38
EC2 Windows - Joining a domain via cfn-init
"UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [
"<powershell>\n",
"pip install -U cumulus-bundle-handler\n",
"# Join the AD domain\n",
"$password = \"MyPassW0rd\" | ConvertTo-SecureString -asPlainText -Force\n",
"$username = \"example.com\\username\"\n",
"$credential = New-Object System.Management.Automation.PSCredential($username,$password)\n",
"Add-Computer -domainname example.com -OUPath \"OU=Servers,OU=Resources,OU=ORGANIZATION,DC=example,DC=com\" -Credential $credential -passthru \n",
@gavinhungry
gavinhungry / nginx-tls.conf
Last active March 11, 2024 14:51
Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Name: nginx-tls.conf
# Auth: Gavin Lloyd <gavinhungry@gmail.com>
# Desc: Nginx SSL/TLS configuration for "A+" Qualys SSL Labs rating
#
# Enables HTTP/2, PFS, HSTS and OCSP stapling. Configuration options not related
# to SSL/TLS are not included here.
#
# Additional tips:
#
@bradmontgomery
bradmontgomery / install-comodo-ssl-cert-for-nginx.rst
Last active April 1, 2024 11:21
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert