Skip to content

Instantly share code, notes, and snippets.

View danteay's full-sized avatar
:atom:
Working from home

Eduardo Aguilar Yépez danteay

:atom:
Working from home
View GitHub Profile
@danteay
danteay / nix-installation.md
Created April 23, 2024 23:10
Nix installation (flakes + home-manager)

Install

Nix es entre varias cosas un gestor de paquetes que mantiene separacion entre las dependencias de cada proyecto sin interferir con el sistema de la PC directamente mediante la gestion de diferentes sources configurados mediante links simbolicos al sistema principal.

Podemos compararlo con Homebrew el cual es el gestor de paquetes mas comunmente usado en MacOS, la mayor diferencia es que mientras que brew instala las dependencias dentro de una carpeta propia del disco del sistema principal, nix maneja todas las dependencias requeridas dentro de un volumen de disco logico completamente aparte del sistema de archivos principal de la PC.

@danteay
danteay / Makefile
Created January 24, 2022 21:01
Make file for commands in go projects
help: ## Display this help screen.
@grep -h -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
install: ## Install all dependencies for Go and Serverless framework
@go mod download && go mod tidy
precommit_install: ## Install precommit actions
@pre-commit install && pre-commit install --hook-type commit-msg
build: clean ## Build the project binary
@danteay
danteay / boto_sns.py
Created January 16, 2021 00:51 — forked from gjedeer/boto_sns.py
How to send a push notification directly to device using Python, Boto and SNS
import boto
import boto.exception
import boto.sns
import pprint
import re
def send_push(device_id, body):
region = [r for r in boto.sns.regions() if r.name==u'eu-west-1'][0]
sns = boto.sns.SNSConnection(
@danteay
danteay / node_nginx_ssl.md
Created November 24, 2020 08:55 — forked from bradtraversy/node_nginx_ssl.md
Node app deploy with nginx & SSL

Node.js Deployment

Steps to deploy a Node.js app to DigitalOcean using PM2, NGINX as a reverse proxy and an SSL from LetsEncrypt

1. Sign up for Digital Ocean

If you use the referal link below, you get $10 free (1 or 2 months) https://m.do.co/c/5424d440c63a

2. Create a droplet and log in via ssh

I will be using the root user, but would suggest creating a new user

@danteay
danteay / install-php.sh
Last active April 8, 2020 22:43
Install the available php version for your ubuntu system
#!/bin/bash
# Install PHP runtime
PHPV=$(echo $(apt search php7. | grep '^php7\.' | head -1) | tr "/" "\n" | head -1)
sudo apt install \
$PHPV \
$PHPV-cli \
$PHPV-cgi \
#!/bin/bash
echo $(dpkg --list | grep linux-image | awk '{ print $2 }' | sort -V | sed -n '/'`uname -r`'/q;p') $(dpkg --list | grep linux-headers | awk '{ print $2 }' | sort -V | sed -n '/'"$(uname -r | sed "s/\([0-9.-]*\)-\([^0-9]\+\)/\1/")"'/q;p') | xargs sudo apt-get -y purge
@danteay
danteay / config.php
Created March 13, 2019 19:53
config twig for slim 3
<?php
// Renderer settings
return [
'settigns' => [
'renderer' => [
'template_path' => __DIR__ . '/views',
],
// twig view settings
'twig' => [
@danteay
danteay / renderer-twig.php
Created March 13, 2019 17:37
Twig dependency for Slim 3
<?php
/**
* Global settings for project configuration
*
* PHP Version 7.1
*
* @category Dependency
* @package CorePHP_Slim_Scafold
* @author Eduardo Aguilar <dante.aguilar41@gmail.com>
* @copyright 2018 Eduardo Aguilar
@danteay
danteay / JWTMiddleaware.php
Created March 13, 2019 14:54
JWT middleaware for Slim 3
<?php
/**
* Global settings for project configuration
*
* PHP Version 7.1
*
* @category Scafolding
* @package CorePHP_Slim_Scafold
* @author Eduardo Aguilar <dante.aguilar41@gmail.com>
* @copyright 2018 Eduardo Aguilar
@danteay
danteay / put-object-on-aws-s3.php
Created February 6, 2019 06:11 — forked from keithweaver/put-object-on-aws-s3.php
Upload an image/object to an AWS S3 Bucket using PHP
<?php
// Installed the need packages with Composer by running:
// $ composer require aws/aws-sdk-php
$filePath = "https://example.com/test.png";
require 'vendor/autoload.php';
$bucketName = 'YOUR_BUCKET_NAME';
$filePath = './YOUR_FILE_NAME.png';