Skip to content

Instantly share code, notes, and snippets.

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

Alexander J. Rodriguez D. AlexR1712

🏠
Working from home
View GitHub Profile
@AlexR1712
AlexR1712 / cv2_detect.py
Created September 10, 2017 23:58 — forked from npinto/cv2_detect.py
Simple face detection with OpenCV 'cv2' python bindings from 2.4.x
import cv2
import cv2.cv as cv
def detect(img, cascade_fn='haarcascades/haarcascade_frontalface_alt.xml',
scaleFactor=1.3, minNeighbors=4, minSize=(20, 20),
flags=cv.CV_HAAR_SCALE_IMAGE):
cascade = cv2.CascadeClassifier(cascade_fn)
rects = cascade.detectMultiScale(img, scaleFactor=scaleFactor,
@AlexR1712
AlexR1712 / solveshit.js
Created July 20, 2017 05:48
solveshit.js
var isFirefox = navigator.userAgent.toLowerCase().indexOf('firefox') > -1;
if (!isFirefox) {
document.styleSheets[2].addRule("::-webkit-scrollbar-thumb", "background: "+document.getElementsByTagName('meta')['theme-color'].content+';');
}
@AlexR1712
AlexR1712 / snippets.js
Created July 19, 2017 12:09
Snnipets JS time scheduling
// source https://supple.com.au/tools/facebook-messenger-website-chat-widget/#
var ot = Array();
ot['mon'] = '9:00 AM-5:00 PM';
ot['tue'] = '9:00 AM-5:00 PM';
ot['wed'] = '9:00 AM-5:00 PM';
ot['thu'] = '9:00 AM-5:00 PM';
ot['fri'] = '9:00 AM-5:00 PM';
ot['sat'] = '9:00 AM-5:00 PM';
ot['sun'] = '9:00 AM-5:00 PM';
var tz = '-04:00,0';
@AlexR1712
AlexR1712 / LogMeIn.php
Created May 20, 2017 17:57 — forked from kmark/LogMeIn.php
PHP implementation of cPanel's Perl LogMeIn class.
<?php
namespace cPanel;
/**************************************************************************************
* Copyright (c) 2013, cPanel, Inc. *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, *
* are permitted provided that the following conditions are met: *
* *
Mover carpeta docker
docker ps -q | xargs docker kill
stop docker
cd /var/lib/docker/devicemapper/mnt
umount ./*
mv /var/lib/docker $dest
ln -s $dest /var/lib/docker
start docker
@AlexR1712
AlexR1712 / script.sh
Created April 13, 2017 14:41
Webhook Flask Gitlab
#!/bin/bash
git pull
cd laradock
docker-compose down
docker-compose up -d nginx mysql phpmyadmin
@AlexR1712
AlexR1712 / packtpub_redeem.sh
Last active April 11, 2017 12:51 — forked from hgouveia/packtpub_redeem.sh
Script to redeem automatically books from `https://www.packtpub.com/packt/offers/free-learning` using bash and cronjob
#!/bin/bash
#==INSTRUCTIONS
# - Add EMAIL and PASS infomation
# - Replace script path with your path `/home/USER/scripts/` in the script
# - Check your machine timezone `date +"%Z %z"` output ex: UTC +0000
# - patckpub.com is UTC +0000, find the best hour for you to use in the crontab
# - Execute `crontab -e`
# - Add `0 1 * * * /bin/sh /home/USER/scripts/packtpub_redeem.sh > /home/USER/scripts/packtpub_redeem.out` , this mean everyday 1am
# - Restart Service `sudo service cron reload` (optional, crontab -e, will reload)
# - Add Permission `chmod 755 /home/USER/scripts/packtpub_redeem.sh`
@AlexR1712
AlexR1712 / bash.md
Last active April 7, 2017 16:25
Comandos Utiles Terminal

Contar Archivos en un Directorio

ls -F | grep -v / | wc -l

Mostrar ultimas 20 lines de un archivo

tail -20 bigfile.txt

From zero to microservice with 𝚫 now

The following guide will show you how to deploy a simple microservice written in JavaScript using 𝚫 now.

It uses Open Source tools that are widely available, tested and understood:

  • Node.JS
  • NPM
  • Express
# stop script on error signal
set -e
# remove old deployment folders
if [ -d "/home/forge/weather-deploy" ]; then
rm -R /home/forge/weather-deploy
fi
if [ -d "/home/forge/weather-backup" ]; then
rm -R /home/forge/weather-backup
fi