Skip to content

Instantly share code, notes, and snippets.

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

adonis simo simo97

🏠
Working from home
View GitHub Profile
@simo97
simo97 / postgres-brew.md
Created June 24, 2019 14:29 — forked from ibraheem4/postgres-brew.md
Installing Postgres via Brew (OSX)

Installing Postgres via Brew

Pre-Reqs

Brew Package Manager

In your command-line run the following commands:

  1. brew doctor
  2. brew update
@simo97
simo97 / media-query.css
Created September 19, 2019 08:19 — forked from gokulkrishh/media-query.css
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
@simo97
simo97 / slugify.js
Created October 29, 2019 21:31 — forked from codeguy/slugify.js
Create slug from string in Javascript
function string_to_slug (str) {
str = str.replace(/^\s+|\s+$/g, ''); // trim
str = str.toLowerCase();
// remove accents, swap ñ for n, etc
var from = "àáäâèéëêìíïîòóöôùúüûñç·/_,:;";
var to = "aaaaeeeeiiiioooouuuunc------";
for (var i=0, l=from.length ; i<l ; i++) {
str = str.replace(new RegExp(from.charAt(i), 'g'), to.charAt(i));
}
@simo97
simo97 / vanilla-js-cheatsheet.md
Created December 9, 2019 11:30 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@simo97
simo97 / vanilla-js-cheatsheet.md
Created December 9, 2019 11:30 — forked from thegitfather/vanilla-js-cheatsheet.md
Vanilla JavaScript Quick Reference / Cheatsheet
@simo97
simo97 / ec2-host-from-tag-to-env-vars.sh
Created April 17, 2020 17:38 — forked from marcellodesales/ec2-host-from-tag-to-env-vars.sh
Create Environment Variables in EC2 Hosts from EC2 Host Tags, just like Beanstalk or Heroku does!
######
# Author: Marcello de Sales (marcello.desales@gmail.com)
# Description: Create Create Environment Variables in EC2 Hosts from EC2 Host Tags
#
### Requirements:
# * Install jq library (sudo apt-get install -y jq)
# * Install the EC2 Instance Metadata Query Tool (http://aws.amazon.com/code/1825)
#
### Installation:
# * Add the Policy EC2:DescribeTags to a User
@simo97
simo97 / css-media-queries-cheat-sheet.css
Created April 24, 2020 12:34 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@simo97
simo97 / django-q-cluster.config
Last active September 21, 2020 05:32 — forked from codeSamuraii/django-q-cluster.sh
Deploy Django-Q to an EC2 instance with Elastic Beanstalk
container_commands:
01_makemigrations:
command: "python manage.py makemigrations"
leader_only: true
02_migrate:
command: "python manage.py migrate"
leader_only: true
# Patch the current version, circular imports cause an ImportError (see https://github.com/Koed00/django-q/issues/331)
03_patch_django_q:
# Replace line 12 ('from django_q.cluster import worker, monitor') by 'from django_q.cluster import *'
@simo97
simo97 / FileField_manual_initialisation.py
Created June 12, 2021 12:46 — forked from avoiney/FileField_manual_initialisation.py
Manually associate an existing file to a model FileField
# Assuming you have a Article Model like this
# class Article(models.Model):
# ... Some field
# media = models.FileField(upload_to="path_to_inner_media_folder", blank=True)
from django.core.files.base import ContentFile
import os
# Create an article with the associated model
new_article = Article()
@simo97
simo97 / Connecting_postgress_RDS_from_local_via_bastion.md
Created July 23, 2021 01:05 — forked from kshailen/Connecting_postgress_RDS_from_local_via_bastion.md
Ways to connect to postgress RDS instance from bastion host and from local host

When it comes to databases and AWS VPC, best practice is to place your database in private subnet. By definition, private subnet in AWS is not reachable from the Internet because no Internet gateway is attached to private subnet. This is the way you protect your data. This kind of configuration is good for security but bad for data management.

How can you easily access and manage your secured data?

basic_RDS_bastion_architecture

There are two basic ways to acees it.

  1. Access postgres RDS from bastion host. There are following requirements for this.