Skip to content

Instantly share code, notes, and snippets.

View osw4l's full-sized avatar
🎹
Piano player

Oswaldo Rodriguez osw4l

🎹
Piano player
  • universidad libre de colombia
  • Barranquilla, Colombia
  • 04:38 (UTC -05:00)
View GitHub Profile
@osw4l
osw4l / gist:209f084e621c9c4b0d169180ae685740
Created May 29, 2020 00:41 — forked from snaga/gist:7495184
postgresql.conf @ RDS for PostgreSQL
testdb=> SELECT name,setting,unit FROM pg_settings;
name | setting | unit
---------------------------------+---------------------------------------------+------
allow_system_table_mods | off |
application_name | psql |
archive_command | /etc/rds/dbbin/pgscripts/rds_wal_archive %p |
archive_mode | on |
archive_timeout | 300 | s
array_nulls | on |
authentication_timeout | 60 | s
@osw4l
osw4l / postgis instructions
Created May 29, 2020 00:39
postgis configuration to postgres engine
go to
cd /etc/postgresql/10/main
rm postgresql.conf
touch postgresql.conf
nano postgresql.conf
copy and paste below code, get fun :)
@osw4l
osw4l / a_routing.py
Last active April 29, 2020 09:12
channels 2 example
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
import apps.solicitudes.routing
application = ProtocolTypeRouter({
"websocket": AuthMiddlewareStack(
URLRouter(
apps.solicitudes.routing.websocket_urlpatterns
)
),
@osw4l
osw4l / commands.sh
Last active July 24, 2024 02:54
deploy django-osw4l 2020
sudo su -
# update so
sudo apt update
sudo apt upgrade
# install curl
sudo apt install curl
#install docker-compose via curl
@osw4l
osw4l / consumer.py
Created April 1, 2020 23:06
ws channels v1 example <3
from channels import Group
from channels.auth import channel_session_user_from_http
from channels.sessions import channel_session
from apps.calls.models import Contacto
@channel_session_user_from_http
def connect_update_contacto(message, pk):
contacto = Contacto.objects.get(id=pk)
server {
server_name domain.com;
location / {
proxy_pass http://localhost:4500;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
@osw4l
osw4l / _commands.sh
Last active October 19, 2020 11:43
django_deploy
# first steps if you have locales issues
sudo dpkg-reconfigure locales
sudo apt install language-pack-en
sudo locale-gen en_US en_US.UTF-8
nano /etc/default/locale
LANG=en_US.UTF-8
LC_ALL="en_US.UTF-8”
LANGUAGE="en_US:en"
# first steps :)
@action(detail=False, methods=['get'])
def published(self, request):
queryset = self.model.objects.all()
page = self.paginate_queryset(queryset)
if page is not None:
serializer = self.get_serializer(page, many=True)
return self.get_paginated_response(serializer.data)
serializer = self.get_serializer(queryset, many=True)
return Response(serializer.data)
@osw4l
osw4l / _orders
Last active January 6, 2020 06:39 — forked from jaishirb/_orders
deploy
# first steps if you have locales issues
sudo dpkg-reconfigure locales
sudo apt install language-pack-en
sudo locale-gen en_US en_US.UTF-8
nano /etc/default/locale
LANG=en_US.UTF-8
LC_ALL="en_US.UTF-8”
LANGUAGE="en_US:en"
# first steps :)
# heroku backup
heroku pg:backups:capture --app heroku_app_name
heroku pg:backups:download --app heroku_app_name
# when the latest.dump are downloaded
pg_restore --verbose --clean --no-acl --no-owner -h my_rds_host -U user -d db latest.dump
# download backup from remote database
pg_dump -h host -U user -C db --file=db_backup.dump