Skip to content

Instantly share code, notes, and snippets.

View AchuM's full-sized avatar
👋

Achu Abebe AchuM

👋
View GitHub Profile
@AchuM
AchuM / script.sh
Created March 24, 2023 20:09 — forked from vielhuber/script.sh
PostgreSQL: Backup and restore export import pg_dump with password on command line #sql
# best practice: linux
nano ~/.pgpass
*:5432:*:username:password
chmod 0600 ~/.pgpass
# best practice: windows
edit %APPDATA%\postgresql\pgpass.conf
*:5432:*:username:password
# linux
@AchuM
AchuM / Jenkinsfile
Created December 11, 2020 10:10 — forked from jasonk/Jenkinsfile
Docker credential helper for authenticating from environment variables
pipeline {
environment {
DOCKER_REGISTRY = 'https://my-docker-registry.example.com'
DOCKER_CREDS = credentials( 'my-docker-credentials' )
}
}
@AchuM
AchuM / Backup, restore postgres in docker container
Created October 19, 2020 09:51 — forked from gilyes/Backup, restore postgres in docker container
Backup/restore postgres in docker container
Backup:
docker exec -t -u postgres your-db-container pg_dumpall -c > dump_`date +%d-%m-%Y"_"%H_%M_%S`.sql
Restore:
cat your_dump.sql | docker exec -i your-db-container psql -Upostgres
version: "3.5"
services:
sonarqube:
image: sonarqube:7.7-community
ports:
- "80:9000"
depends_on:
- db
networks:
- sonarnet
@AchuM
AchuM / devops_best_practices.md
Created June 10, 2020 14:05 — forked from jpswade/devops_best_practices.md
Devops Best Practices Checklist

Find the original here article here: Devops Best Practices

DevOps started out as "Agile Systems Administration". In 2008, Andrew Shafer did a talk called "Agile Infrastucture" addressing issues around involving more of the company in the same disciplines as programmers.

In 2009, Patrick Debois created "DevOpsDays" conference to help to bring it to light. However, it wouldn't begin to trend until about 2010, when people would begin to describe it as a standalone discipline.

Today, DevOps goes beyond just developers, systems administration and infrastructure, its about [dev, ops, agile, cloud

@AchuM
AchuM / Ansible Let's Encrypt Nginx setup
Last active June 10, 2020 13:44 — 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)

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@AchuM
AchuM / Monit_CPU_RAM_Disk
Last active June 10, 2020 11:31 — forked from mikluko/gist:3897117
Basic monit config to monitor CPU, memory and disk usage
set daemon 30 with start delay 60
set logfile syslog facility log_daemon
set httpd port 2812
allow localhost
set mailserver localhost
set alert alert@example.com but not on { instance }
mail-format {
From: noreply@example.com
@AchuM
AchuM / sort-dir-by-size
Created June 17, 2014 07:39
List all directories and sort by size bash script
#!/bin/bash
if [ $# != 2 ]; then
echo "Incorrect number of arguments !" >&2
echo "USAGE: sortdirbysize [DIRECTORY] <first n directories>"
fi
du --block-size=1M --max-depth 1 $1 | sort -rn | head -$2
## Usage example ./sort-dir-by-size.sh /home/linux 15
@AchuM
AchuM / htaccess
Created October 21, 2013 13:47
From https://snipt.net/public/ .htaccess HTTP caching (Google PageSpeed Friendly)
<IfModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 1 seconds"
ExpiresByType text/html "access plus 1 seconds"
ExpiresByType image/gif "access plus 1 week"
ExpiresByType image/jpeg "access plus 1 week"
ExpiresByType image/png "access plus 1 week"
ExpiresByType text/css "access plus 1 week"
ExpiresByType text/javascript "access 1 week"
ExpiresByType application/x-javascript "access plus 1 week"