Skip to content

Instantly share code, notes, and snippets.

View resourcemode's full-sized avatar
🏠
Working from home

Michael Favila resourcemode

🏠
Working from home
View GitHub Profile
@resourcemode
resourcemode / SQL-required-columns
Created September 20, 2019 06:55
SQL - list all columns that is not nullable
select schema_name(tab.schema_id) as schema_name,
tab.name as table_name,
col.column_id,
col.name as column_name,
t.name as data_type,
col.max_length,
col.precision
from sys.tables as tab
inner join sys.columns as col
on tab.object_id = col.object_id
echo "Open bash for docker containers"
echo "1.) projectA"
echo "2.) projectB"
echo -n "Enter the docker number and press [ENTER]: "
read choice
if [ "$choice" == "1" ]; then
choice='projectA'
elif [ "$choice" == "2" ]; then
@resourcemode
resourcemode / iterm2-solarized.md
Created November 20, 2018 12:47 — forked from kevin-smets/iterm2-solarized.md
iTerm2 + Oh My Zsh + Solarized color scheme + Meslo powerline font + [Powerlevel9k] - (macOS)

Default

Default

Powerlevel9k

Powerlevel9k

@resourcemode
resourcemode / delete-branch.sh
Created June 27, 2017 09:23
Delete git branches using sh script
#!/bin/sh
## declare an array variable
branches=("develop" "master")
repositoryPath="/Users/michael.favila/project/trading-platform"
## now loop through the above array
for i in "${branches[@]}"
do
echo "$repositoryPath ${i}"
@resourcemode
resourcemode / port forwarding
Last active October 4, 2016 03:24
http port forwarding to access VM vagrant hosted applications
Access your local vagrantbox from your remote or other machine within the network.
Get the host machine IP and add it in the /etc/hosts of your server/computer that will access the vagrantbox.
E.g 10.9.6.91 yourdomain.dev
First step is to create this file 'http' in /etc/pf.anchors and add the data below:
rdr-anchor "forwarding"
load anchor "forwarding" from "/etc/pf.anchors/http"
Next step is to create this file 'pf-http.conf' in /etc and add the data below:
rdr-anchor "forwarding"
@resourcemode
resourcemode / nginx
Created August 25, 2016 09:49 — forked from pzorn/nginx
php-fpm and nginx init.d script
#!/bin/sh
#
# nginx - this script starts and stops the nginx daemin
#
# chkconfig: - 85 15
# description: Nginx is an HTTP(S) server, HTTP(S) reverse \
# proxy and IMAP/POP3 proxy server
# processname: nginx
# config: /usr/local/nginx/conf/nginx.conf
# pidfile: /usr/local/nginx/logs/nginx.pid
@resourcemode
resourcemode / importmysql.sh
Last active August 18, 2016 02:20
import mysql
#!/bin/bash
FILES=/Users/IT/dumps/LocalDB/*
for f in $FILES
do
echo "Processing $f file..."
# take action on each file. $f store current file name
mysql -uDBUSER -hDBHOST --pDBPASSWORD DBNAME < $f
done
<?php
/* From https://www.usps.com/send/official-abbreviations.htm */
$us_state_abbrevs_names = array(
'AL'=>'ALABAMA',
'AK'=>'ALASKA',
'AS'=>'AMERICAN SAMOA',
'AZ'=>'ARIZONA',
'AR'=>'ARKANSAS',
@resourcemode
resourcemode / osx .profile
Created January 6, 2015 02:06
easy way to restart nginx, fpm, mysql
# MacPorts Installer addition on 2014-12-05_at_17:01:26: adding an appropriate PATH variable for use with MacPorts.
export PATH="/opt/local/bin:/opt/local/sbin:$PATH"
# Finished adapting your PATH environment variable for use with MacPorts.
alias mysql_start='sudo /opt/local/share/mysql55/support-files/mysql.server start'
alias mysql_stop='sudo /opt/local/share/mysql55/support-files/mysql.server stop'
export PATH=$PATH:/usr/local/mysql/bin
# nginx
@resourcemode
resourcemode / vhost-config-apache
Created August 14, 2014 08:38
apigility apache vhost config
# apigility.com
Listen 127.0.0.1:9271
NameVirtualHost 127.0.0.1:9271
<VirtualHost 127.0.0.1:9271>
DocumentRoot "D:\EasyPHP\data\localweb\projects\apigility.com\www"
RewriteEngine off
<Location />
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]