Skip to content

Instantly share code, notes, and snippets.

View Lh4cKg's full-sized avatar
🐍
Working

Lasha Gogua Lh4cKg

🐍
Working
View GitHub Profile
@Lh4cKg
Lh4cKg / install_hp.sh
Last active April 11, 2025 15:49
Installing networked HP printer and scanner on Fedora Linux
# docs for more information see the official HPLIP project site here.
# https://developers.hp.com/hp-linux-imaging-and-printing
# Step 1. Update Fedora Linux
# Simply run dnf command:
$ sudo dnf upgrade
# Step 2. Search for HPLIP software
@register.simple_tag
def get_protected_attribute(obj, field):
return obj[field].value()
@Lh4cKg
Lh4cKg / aggregation_lookup.md
Created February 18, 2019 17:16 — forked from bertrandmartel/aggregation_lookup.md
MongoDB $lookup aggregation example

MongoDB $lookup aggregation

SO link

db.votes.aggregate([{
    $lookup: {
        from: "users",
        localField: "createdBy",
        foreignField: "_id",
@Lh4cKg
Lh4cKg / docker_cheat.md
Created February 7, 2019 13:53 — forked from wsargent/docker_cheat.md
Docker cheat sheet
@Lh4cKg
Lh4cKg / nbg.py
Created September 19, 2018 15:44
NBG currency rates
"""
Service API:
public string GetCurrency(Currency cur) αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ αƒ•αƒαƒšαƒ£αƒ’αƒ˜αƒ‘ კურბბ, მაგ. "1.0754"
public string GetCurrencyDescription(Currency cur) αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ αƒ•αƒαƒšαƒ£αƒ’αƒ˜αƒ‘ აღწერაბ, მაგ. "10 αƒ”αƒ‘αƒ’αƒαƒ αƒœαƒ£αƒ αƒ˜ αƒ™αƒ αƒαƒœαƒ˜"
public string GetCurrencyChange(Currency cur) αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ αƒ•αƒαƒšαƒ£αƒ’αƒ˜αƒ‘ αƒͺαƒ•αƒšαƒ˜αƒšαƒ”αƒ‘αƒ˜αƒ‘ αƒ›αƒœαƒ˜αƒ¨αƒ•αƒœαƒ”αƒšαƒαƒ‘αƒαƒ‘, მაგ. "-0.0121"
public int GetCurrencyRate(Currency cur) 1 - თუ αƒ’αƒαƒ˜αƒ–αƒαƒ αƒ“αƒ; -1 - თუ αƒ“αƒαƒ˜αƒ™αƒšαƒ, 0 - თუ αƒ˜αƒ’αƒ˜αƒ•αƒ” დარჩა
public string GetDate() αƒαƒ‘αƒ αƒ£αƒœαƒ”αƒ‘αƒ‘ αƒ™αƒ£αƒ αƒ‘αƒ”αƒ‘αƒ˜αƒ‘ αƒ¨αƒ”αƒ‘αƒαƒ‘αƒαƒ›αƒ˜αƒ‘ αƒ—αƒαƒ αƒ˜αƒ¦αƒ‘
"""
@Lh4cKg
Lh4cKg / django_setup.py
Last active May 22, 2018 21:25
configure and run django script file
# old django version: 1.6.x
# configure and run django script
if __name__ == '__main__':
import os
import sys
import importlib
proj_path = '/home/gogua/projects/profenv/profiling/'
sys.path.append(proj_path)
@Lh4cKg
Lh4cKg / geo_alphabet.py
Last active October 26, 2017 07:15
Georgian Alphabet Range
# Python 2.x
for x in [unichr(i) for i in range(ord(u'ა'),ord(u'αƒ°') +1)]:
pattern = unicode("!@#$%^&*()_+=-~`[]\{}|:\"?><,./;'\`β€ž\"")
char = re.sub('[%s]' % re.escape(''.join(pattern)), '', x.strip())
print char
# Python 3.x
for x in [chr(i) for i in range(ord('ა'),ord('αƒ°') +1)]:
pattern = "!@#$%^&*()_+=-~`[]\{}|:\"?><,./;'\`β€ž\""
@Lh4cKg
Lh4cKg / Django + Ajax dynamic forms .py
Created May 26, 2017 09:41 — forked from goldhand/Django + Ajax dynamic forms .py
Django form with Ajax. A simple Task model that can be updated using a CBV with an AJAX mixin. The view sends post data with ajax then updates the view with a callback to a DetailView with a json mixin.There is an abstract CBV, AjaxableResponseMixin, based on the example form django docs, that is subclassed in the TaskUpdateView CBV. TaskUpdateV…
#models.py
class Task(models.Model):
title = models.CharField(max_length=255)
description = models.TextField()
def __unicode__(self):
return self.title
@Lh4cKg
Lh4cKg / forms.py
Last active March 21, 2021 18:24
Django Bootstrap Registration Form | Jqwidgets Style Registration Form, using jqwidgets
# _*_ coding: utf-8 _*_
"""
IPC
Created on Apr 24, 2017
@author: lasha gogua
"""
from django import forms
@Lh4cKg
Lh4cKg / celery.py
Last active January 23, 2020 06:12
Installing And Configuration Django 1.10 && Celery 4.0.2 && RabbitMQ
1. django (latest version)
$ pip install django
2. celery (latest version)
$ pip install celery
first steps
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html
install celery extension
$ pip install django-celery-beat
docs: http://docs.celeryproject.org/en/latest/django/first-steps-with-django.html#django-celery-beat