Skip to content

Instantly share code, notes, and snippets.

View eduardobc88's full-sized avatar
:octocat:
Working from home

EDUARDO BELTRAN CARBAJAL eduardobc88

:octocat:
Working from home
View GitHub Profile
// NOTE: 2- BUTTON PUTS LED ON
int pinLed = 3;
int pinButton = 2;
int buttonState = 0;
int pressCount = 0;
bool isFirstPress = false;
void setup() {
// NOTE: 1- LED BLINKING
int pinLed = 13;
void setup() {
// put your setup code here, to run once:
pinMode(pinLed, OUTPUT); // NOTE: specifying pin (13) as output
digitalWrite(pinLed, HIGH); // NOTE: sends 5v to pin (13)
digitalWrite(pinLed, LOW); // NOTE: sends 0v to pin (13)
}
@eduardobc88
eduardobc88 / git-hooks.sh
Last active March 5, 2021 03:28
Steps to configure the server and client for push git branch into the server side
# 1- (server) create a git repository on server side
git init --bare ~/<projec-name>
# 2- (server) into the directory: '~/<project-name>/hooks/' create a file: 'post-receive' and add this:
!/bin/bash
while read oldrev newrev ref
do
if [[ $ref =~ .*/master$ ]];
then
echo "== GIT HOOKS : Master ref received. Deploying master branch to production... =="
git --work-tree=~/<dir-name>/<dir-name>/ checkout -f master
@eduardobc88
eduardobc88 / hook.go
Created March 10, 2020 21:49
Example Golang hooks
package hook
import "fmt"
// model struct
type ItemType struct {
// define props
}
@eduardobc88
eduardobc88 / docker-architecture-services.sh
Last active April 24, 2019 21:09
Docker script to create architecture services and network communication hub
echo "== CREATE DOCKER MICROSERVICES INFRAESTRUCTURE =="
echo "==== creating hub network ====";
sudo docker network create autocom-services-hub-network --subnet=172.1.1.0/24
sleep 5;
wait
echo "==== creating reverse proxy ====";
sudo docker run --name ms-nginx-reverse-proxy-server -d --ip 172.1.1.2 --net autocom-services-hub-network -p 80:80 -v /home/lalo/Docker/AutocomServices/ms-nginx-reverse-proxy-server:/shared --hostname ms-nginx-reverse-proxy-server -i centos:7
sleep 5;
wait
echo "==== creating api gateway ====";
@eduardobc88
eduardobc88 / shell-installations.sh
Last active June 26, 2019 22:40
Shell Scripts for installations
# Python
$sudo yum install centos-release-scl
$sudo yum install rh-python36
$scl enable rh-python36 bash
$python --version
$pip
# NodeJS - NVM
$curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
$nvm --version # list all versions
@eduardobc88
eduardobc88 / merge-a-repository-into-another.sh
Last active February 1, 2019 00:18
Merge a repository into the other repository
cd path/to/project-b
git remote add project-a path/to/project-a
git fetch project-a
git merge --allow-unrelated-histories project-a/master --squash # or whichever branch you want to merge
git remote remove project-a
# ~/.bash_profile
[[ -s ~/.bashrc ]] && source ~/.bashrc
export CLICOLOR=1
export LSCOLORS=GxFxCxDxBxegedabagaced
function prompt {
local BLACK="\[\033[0;30m\]"
local BLACKBOLD="\[\033[1;30m\]"
@eduardobc88
eduardobc88 / express_remove_route.js
Created March 23, 2017 17:38
Express remove route
function express_remove_route(router_path,callback) {
express_stack = router.stack;
console.log("================= express_remove_route ==================");
express_stack.forEach(function(route_layer){
if( !route_layer ) return;
if( route_layer.route.path.indexOf(router_path) >= 1 ) {
//console.log(router_path,route_layer.route.path.indexOf(router_path)); // log layer
idx = express_stack.indexOf(route_layer);
//console.log("IDX",idx); // id to remove layer
express_stack.splice(idx, 1);
@eduardobc88
eduardobc88 / android.sh
Created November 23, 2016 19:09
Android ADB Shell Commands
# Copy some file from android device system with adb. It will be hide
adb shell run-as com.g4a.quadratin cp /data/data/com.g4a.quadratin/databases/quadratin_app.db /sdcard/DB