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 / nginx.conf
Created August 7, 2016 20:42 — forked from o-shabashov/nginx.conf
Nginx 1.10.* + LetsEncrypt SSL (A+) + HTTP/2 + PHP7-FPM + Force HTTPS sample config
server {
listen 80;
server_name domain.com;
root /var/www/domain.com;
location ~ /.well-known {
allow all;
}
location ~ /\.ht {
@AlexR1712
AlexR1712 / README.md
Created January 20, 2017 20:09 — forked from oodavid/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
# 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

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
@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 / 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: *
* *
@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 / 0x00000.bin
Created October 12, 2017 19:21 — forked from ajfisher/0x00000.bin
ESP8266 Transparent bridge to J5
@AlexR1712
AlexR1712 / image.php
Created October 23, 2017 14:03
gaussian blur in one sector of the image PHP
<?php
$loadFile = 'https://c1.staticflickr.com/5/4094/4809804115_40f52c8f25_b.jpg';
$image = imagecreatefromstring(file_get_contents($loadFile));
if ($image !== false) {
$face = imagecrop($image, ['x' => 152, 'y' => 568, 'width' => 199, 'height' => 199]);
@AlexR1712
AlexR1712 / Enigma.php
Created October 26, 2017 01:48
PHP Enigma Machine
<?php namespace App\Services;
/**
* A PHP version of the Enigma machine.
* Wikipedia: http://en.wikipedia.org/wiki/Enigma_machine
*
* This might not be an accurate representation. I have never seen, nor used an enigma machine.
* This class was created by reading the article at http://enigma.louisedade.co.uk/howitworks.html.
*
* Usage: