Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Jorge Morales morales2k

🏠
Working from home
View GitHub Profile
@morales2k
morales2k / .profile
Created Dec 17, 2019
Clear laradock workspace laravel project cache without keeping the terminal bound inside the workspace at the end.
View .profile
alias cddocker='cd ~/laradock' #path to your laradock folder
# Get on your workspace move to the laravel directory and invoke artisan commands to clear
# caches without keeping your terminal inside the workspace at the end.
function wipe-caches() {
( cddocker && docker-compose exec --user laradock workspace bash -c "cd laravel && php artisan config:clear && php artisan cache:clear" )
}
@morales2k
morales2k / .profile
Last active Nov 6, 2019
Little bash script you can pass args to and test cors headers with.
View .profile
#same functionality in a bash profile function
function cors-test() {
ORIGIN=$1
URI=$2
METHOD=$3
if [ -z "$3" ] && [ -z "$METHOD" ]; then
echo -e "\033[0;33mSince you did not provide a method, the default GET will be used.\nYou can provide a third param to specify the method\n(to use with the curl -X option).\033[1;33m\033[0m\n"
METHOD="-X ${METHOD}"
fi
@morales2k
morales2k / Homestead.yaml
Last active Dec 14, 2017
For use with Laravel Homestead. Set a server_name to add for ngrok (or similar services, but my useccase is ngrok.) With this type of setup, I can use Homestead globally (only one vm for many sites) and add an additional domain for ngrok on the sites I wish to load it with.
View Homestead.yaml
---
ip: "10.10.192.168"
memory: 2048
cpus: 1
provider: virtualbox
name: homestead-7
authorize: ~/.ssh/id_rsa.pub
keys:
@morales2k
morales2k / .bash_profile
Last active Dec 12, 2017
My entire bash_profile aliases.
View .bash_profile
#nvm stuff their installer adds
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
#nvm stuff end...
#add composer to PATH
export PATH=~/.composer/vendor/bin:$PATH
#aliases to make my life easier
alias phpunit=./vendor/bin/phpunit
@morales2k
morales2k / AppServiceProvider.php
Last active May 5, 2018
Some custom Laravel validation rules
View AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Validator;
class AppServiceProvider extends ServiceProvider
{
/**
View keybase.md

Keybase proof

I hereby claim:

  • I am morales2k on github.
  • I am morales2k (https://keybase.io/morales2k) on keybase.
  • I have a public key whose fingerprint is 1AFA F283 1358 C560 6CEA B2CE FE71 D6F5 43DC 3CF7

To claim this, I am signing this object:

View url_matching_regex.txt
^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,12})([\/\w-\.]*)?\??([=\w+&%\s-]?)*$
@morales2k
morales2k / ssh_somewhere.command
Created May 10, 2016
Bash script to ssh into an amazon or other remote host. I made this script to have a single shortcut on my desktop to use in order to load a routine that would simplify establishing an ssh pipe to our remote servers, in this snippet 2 servers are used, but as you can see, it can be scaled up easily by adding more options/cases in the code. Happy…
View ssh_somewhere.command
#!/bin/bash
# Bash script to ssh into an amazon or other remote host. I made this script to have a single shortcut on my desktop to use in order to load a routine that would simplify establishing an ssh pipe to our remote servers, in this snippet 2 servers are used, but as you can see, it can be scaled up easily by adding more options/cases in the code. Happy Coding!
# Author: Jorge Morales
#UPDATE THESE VARIABLES WHENEVER THERE ARE CHANGES
test_server="TEST_SERVER_HOST_ADDRESS"
production_server="PRODUCTION_SERVER_HOST_ADDRESS"
pathToCertificate="PATH_TO_KEYFILE"
echo "Type 1 to connect to Test server."
echo "Type 2 to connect to Production server."
@morales2k
morales2k / bulkdelete.py
Last active Jun 8, 2016
Delete files from slack for each access token in the list. Based on: https://gist.github.com/thesoftwarejedi/d78af9ee12b7f7a9d3e7
View bulkdelete.py
import requests
import json
import calendar
import sys
import codecs
from datetime import datetime, timedelta
sys.stdout = codecs.getwriter("utf-8")(sys.stdout, 'strict')
_tokens = ["TOKEN_LIST"]
@morales2k
morales2k / bumpver.sh
Created Oct 2, 2015
Bump deployed version tag inside .env file. For use with Envoyer.io and Laravel 5 to update a VERSION var inside the .env file of your Envoyer releases.
View bumpver.sh
#! /bin/bash
archivo='.env'
filelines=`cat $archivo`
i=0
newfilelines=''
echo "Fetching dirty tags from remote repository..."
gitVersion=`git ls-remote -t {{REPOSITORY-URL}} *.*.*^*`
gv=''
You can’t perform that action at this time.