Skip to content

Instantly share code, notes, and snippets.

View ajaimesv's full-sized avatar
💭
Biking

Andres Jaimes ajaimesv

💭
Biking
View GitHub Profile
@ajaimesv
ajaimesv / gist:b8b2815d99c4ebb6b53ac17e3e532a65
Last active September 19, 2019 15:40 — forked from CristinaSolana/gist:1885435
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@ajaimesv
ajaimesv / bash.md
Created June 14, 2019 01:04
Bash find and exec a command on found files

Couple examples:

sudo find . -type f -name "*.php" -exec chmod ugo+rwx "{}" \;
sudo find . -type f -name "*.php" -exec chmod go-w "{}" \;
@ajaimesv
ajaimesv / remove-ds-store-files.md
Created May 9, 2019 14:27
Recursively remove .ds_store files
find . -name '.DS_Store' -type f -delete
@ajaimesv
ajaimesv / custom-prompt.md
Last active April 30, 2019 18:20
Custom terminal prompt with random emoticon and git branch

Custom terminal prompt with icon and git branch

Apply changes to ~/.bash_profile. Restart you terminal or reread changes using source .bash_profile

HAPPY=(🙂 🙃 🤓 😎)

parse_git_branch() {
  git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
@ajaimesv
ajaimesv / clean-up-boot-partition-ubuntu.md
Created May 29, 2018 16:12 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@ajaimesv
ajaimesv / RandomStringGenerator.java
Created June 21, 2017 12:47
Random String Generator
/*
* Copyright (c) 2017 Andres Jaimes http://andres.jaimes.net
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@ajaimesv
ajaimesv / smb-demo.sh
Created February 18, 2017 01:01
Send command to smbclient from a bash script
#!/bin/sh
basedir=`date +%Y%m%d`
mysqldir=$basedir/mysql
mkdir -p $mysqldir
# backup database to $mysqldir
smbclient "//server/directory" -U user%password << SMBCLIENTCOMMANDS
recurse
@ajaimesv
ajaimesv / docker-compose.yml
Created February 3, 2017 22:03
Sample WordPress docker-compose development setup
# docker-compose up -d
# docker-compose up -d --no-recreate
# docker-compose stop
# docker-compose rm -f
mysql:
image: mysql:5.7
container_name: mysql
environment:
MYSQL_ROOT_PASSWORD: my-password
@ajaimesv
ajaimesv / docker-compose.yml
Created February 3, 2017 22:01
docker-compose for nginx
# Sample file for nginx
# docker-compose up -d
# docker-compose up -d --no-recreate
# docker-compose stop
# docker-compose rm -f
web:
image: nginx:alpine
container_name: nginx
@ajaimesv
ajaimesv / swap.sh
Created January 25, 2017 17:11
Adding swap memory to a running amazon instance
# Add swap memory to a running amazon instance
# Choose your swap size, in this case 4096M (4G)
sudo /bin/dd if=/dev/zero of=/var/swap.1 bs=1M count=4096
sudo /sbin/mkswap /var/swap.1
sudo chmod 600 /var/swap.1
sudo /sbin/swapon /var/swap.1
# Add the following line to /etc/fstab to enable swap at boot: