Skip to content

Instantly share code, notes, and snippets.

View mauricios's full-sized avatar
🎯
Focusing

Mauricio Sánchez mauricios

🎯
Focusing
View GitHub Profile
@mauricios
mauricios / atom-config.cson
Last active August 27, 2017 14:32
Atom preferences file
"*":
"ansible-vault":
vault_automatic_de_and_encrypt: true
"atom-beautify":
php: {}
"autocomplete-ansible":
pythonPaths: "/usr/local/Cellar/ansible/2.3.2.0_1/libexec/bin/python2.7"
autosave:
enabled: true
core:
@mauricios
mauricios / aws_cloudwatch_logs_iam_policy.json
Last active May 30, 2017 22:00
AWS CloudWatch Logs IAM policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"logs:CreateLogGroup",
"logs:CreateLogStream",
"logs:PutLogEvents",
"logs:DescribeLogStreams"
@mauricios
mauricios / varnish_useful_commands.sh
Last active October 14, 2017 01:09
Varnish useful commands
#!/bin/sh
# Check configuration file
sudo varnishd -C -f /path/to/default.vcl -p vcl_dir=/path/to/vcl_dir
# Ban/Purge a URL
sudo varnishadm "ban req.http.host ~ ^<hostname>$ && req.url ~ ^<url>$"
# Change configuration
## Show list of configurations
@mauricios
mauricios / curl_time_format.txt
Last active February 17, 2022 18:21
CURL format file to summarize loading times results of a page
Content Type: %{content_type}\n
HTTP Code: %{http_code}\n
HTTP Connect: %{http_connect}\n
Number Connects: %{num_connects}\n
Number Redirects: %{num_redirects}\n
Redirect URL: %{redirect_url}\n
Size Download: %{size_download}\n
Average speed download: %{speed_download}\n
Size Upload: %{size_upload}\n
SSL Verify: %{ssl_verify_result}\n
@mauricios
mauricios / resize_ebs_volume.md
Last active November 8, 2019 18:35
Resize EBS volume

Resize AWS EBS Disk partition

The following commands are rquiered to expoand a partition and resize the file system of an EBS volume. Those steps work in EBS volumes including root volumes and can be done while they are attached to a running instance (zero downtime)

Check the size of the partition

df -H
@mauricios
mauricios / hyper.js
Last active December 25, 2018 22:44
Hyper terminal preferences
module.exports = {
config: {
fontSize: 14,
fontFamily: '"Fira Mono", Menlo, "DejaVu Sans Mono", Consolas, "Lucida Console", monospace',
cursorColor: 'cyan',
cursorShape: 'BEAM',
cursorBlink: false,
foregroundColor: '#ffffff',
backgroundColor: '#000000',
borderColor: '#000000',
@mauricios
mauricios / migrate_git_repo.sh
Last active December 28, 2017 15:48
Migrate Git repo from one remote to another
#!/bin/bash
# Clone the old repo using the mirror option
git clone --mirror git@git.my-old-server.com:my-old-repo.git
# Enter the new clonned repo directory
cd my-old-repo.git
# Add the new remote repo
git remote add new_origin git@git.my-new-server.com:my-new-repo.git
@mauricios
mauricios / text_manipulation.sh
Last active April 23, 2022 21:47
Text manipulation commands
!# /bin/bash
# Replace string in all files in a directory (macOS)
grep -Rnl "old_string" **/*.txt | xargs sed -i "" 's/old_string/new_string/g'
@mauricios
mauricios / vim_powers
Created February 16, 2018 02:01
Vim powers
- Search and replace: :%s/foo/bar/g
- Delete text block: ma + d'a
- Macro: qd, <commands>, then q, apply with @d and @@
- Write as sudo: :w !sudo tee %
- Increase/Decrease number: Ctl+A Ctl+X
@mauricios
mauricios / gpg_useful_commands.md
Created August 31, 2018 16:41
GPG useful commands

Generate the GPG key pair

gpg --full-generate-key;

Export public GPG key

Look for your Key ID in using the following command: