Skip to content

Instantly share code, notes, and snippets.

View amirrpp's full-sized avatar
🎯
Focusing

Amir Aziiev amirrpp

🎯
Focusing
  • Django Stars
  • Ukraine
View GitHub Profile
@amirrpp
amirrpp / ansible_local_playbooks.md
Created May 22, 2020 05:27 — forked from alces/ansible_local_playbooks.md
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@amirrpp
amirrpp / postgres_queries_and_commands.sql
Last active September 10, 2019 09:30 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@amirrpp
amirrpp / alex1.c
Last active September 5, 2018 17:12
#include <stdio.h>
#include <string.h>
int main(void) {
char name1[18], name2[18], name3[18];
char group1[3], group2[3], group3[3];
char place1[30], place2[30], place3[30];
unsigned int count1, count2, count3;
int col_len1 = 9, col_len3 = 16;
int name_len1, name_len2, name_len3;
@amirrpp
amirrpp / serve.go
Created April 17, 2018 06:47 — forked from paulmach/serve.go
Simple Static File Server in Go
/*
Serve is a very simple static file server in go
Usage:
-p="8100": port to serve on
-d=".": the directory of static files to host
Navigating to http://localhost:8100 will display the index.html or directory
listing file.
*/
package main
#!/bin/bash
cat <<EOT > /etc/default/locale
LANGUAGE=en_US.UTF-8
LC_ALL=en_US.UTF-8
LANG=en_US.UTF-8
LC_TYPE=en_US.UTF-8
EOT
locale-gen en_US.UTF-8
@amirrpp
amirrpp / postgresql-set-id-seq.sql
Created March 29, 2018 14:05 — forked from henriquemenezes/postgresql-set-id-seq.sql
PostgreSQL set Next ID Sequence Value to MAX(id) from Table
-- Get Max ID from table
SELECT MAX(id) FROM table;
-- Get Next ID from table
SELECT nextval('table_id_seq');
-- Set Next ID Value to MAX ID
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
from django.db import models
class AbstractSeoContent(models.Model):
h1 = models.CharField('H1', max_length=255, blank=True)
meta_title = models.CharField(_('Title for page'), max_length=255, blank=True)
meta_description = models.CharField(max_length=255, blank=True)
meta_canonical = models.CharField(max_length=255, blank=True)
meta_keywords = models.CharField(max_length=255, blank=True)
meta_robots = models.CharField(max_length=255, blank=True)
@amirrpp
amirrpp / start_docker_registry.bash
Created June 15, 2017 13:04 — forked from PieterScheffers/start_docker_registry.bash
Start docker registry with letsencrypt certificates (Linux Ubuntu)
#!/usr/bin/env bash
# install docker
# https://docs.docker.com/engine/installation/linux/ubuntulinux/
# install docker-compose
# https://docs.docker.com/compose/install/
# install letsencrypt
# https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
@amirrpp
amirrpp / friggReadme.md
Created September 28, 2016 12:13 — forked from m-bo-one/friggReadme.md
frigg(cloudapp) API description

Changelog

v2.0

  • Restructured back-end part of project - moved on web api;
  • removed banner section;
  • removed get latest video and text lessons section;
  • changed some parts of api (see all sections which key is changed/removed):
    • patronymic -> middle_name;
    • photo -> image;
    • text -> description (not in all parts);

Changelog

v1.0

  • added russian error presentation (add Accept-Language: ru;q=1 in header of request);
  • removed [] from error value;
  • changed error keys: non_field_errors -> error, detail -> error;

v1.1

  • changed error translation in documentation;
  • added admin panel link to docs;
  • added online-lesson descr in docs;