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 / colors.css
Created November 25, 2021 21:47 — forked from robodl/colors.css
Wagtail - Draftail - Multiple color highlighter
.cm-green {
background-image: linear-gradient(30deg,#16d6d9,#96cc29);
}
.cm-blue {
background-image: linear-gradient(30deg,#009cf3,#16d6d9);
}
.cm-pink {
background-image: linear-gradient(30deg,#ff2277,#7a288c);
@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 / 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 / beautiful_idiomatic_python.md
Created May 30, 2016 20:19 — forked from JeffPaine/beautiful_idiomatic_python.md
Transforming Code into Beautiful, Idiomatic Python: notes from Raymond Hettinger's talk at pycon US 2013. The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
@Lh4cKg
Lh4cKg / multi-git.md
Created April 9, 2016 16:47 — forked from rosswd/multi-git-win.md
Setting up a Github and Bitbucket account on the same computer.

Setting up github and bitbucket on the same computer

Github will be the main account and bitbucket the secondary.

Create SSH Keys

ssh-keygen -t rsa -C "github email"

Enter passphrase when prompted. If you see an option to save the passphrase in your keychain, do it for an easier life.

@Lh4cKg
Lh4cKg / tmux-cheatsheet.markdown
Created March 31, 2016 18:20 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@Lh4cKg
Lh4cKg / bobp-python.md
Created February 14, 2016 06:09 — forked from sloria/bobp-python.md
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@Lh4cKg
Lh4cKg / spin.py
Created January 20, 2016 19:02 — forked from arindampradhan/spin.py
Spinners for python | python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import signal
from os import system
### MENU ###
# Here are all the elements you can import
# Box elements
@Lh4cKg
Lh4cKg / migrator.sh
Created November 19, 2015 16:59 — forked from vigneshwaranr/migrator.sh
Script to convert SQLITE dumps into PostgreSQL compatible dumps
#! /bin/sh
usage_error () {
echo 'Usage: sh migrator.sh <path to sqlite_to_postgres.py> <path to sqlite db file> <an empty dir to output dump files>'
echo
echo 'Example:'
echo '>sh migrator.sh sqlite_to_postgres.py ~/reviewboard.db /tmp/dumps'
echo
echo 'Tested on:'
echo 'Python 2.7.3'