Skip to content

Instantly share code, notes, and snippets.

View om2c0de's full-sized avatar
🖋️
Innovating

Alexandr Skripkin om2c0de

🖋️
Innovating
View GitHub Profile
@om2c0de
om2c0de / kivyconsole.py
Created November 29, 2021 14:38 — forked from aron-bordin/kivyconsole.py
Initial Python/Kivy Terminal Emulator (It's just a performance test. You can use this sample to write your own terminal emulator)
from kivy.base import runTouchApp
from kivy.event import EventDispatcher
from kivy.lang import Builder
from kivy.properties import ObjectProperty, ListProperty, StringProperty, \
NumericProperty, Clock, partial
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.textinput import TextInput
import os
import subprocess
import threading
@om2c0de
om2c0de / async_bind.py
Created February 23, 2021 16:08
Imitating 'async_bind'
# imitating 'async_bind'
from kivy.config import Config
Config.set('input', 'mouse', 'mouse,disable_multitouch')
import kivy
kivy.require('2.0.0')
import trio
from kivy.app import App
from kivy.uix.widget import Widget
@om2c0de
om2c0de / get_models_from_app.py
Created January 29, 2021 12:10 — forked from kissgyorgy/get_models_from_app.py
Django: Get list of models from app
# http://stackoverflow.com/questions/8702772/django-get-list-of-models-in-application
from django.db.models import get_app, get_models
app = get_app('my_application_name')
for model in get_models(app):
new_object = model() # Create an instance of that model
model.objects.filter(...) # Query the objects of that model
model._meta.db_table # Get the name of the model in the database
model._meta.verbose_name # Get a verbose name of the model
@om2c0de
om2c0de / git-deployment.md
Created October 3, 2020 18:23 — forked from noelboss/git-deployment.md
Simple automated GIT Deployment using Hooks

Simple automated GIT Deployment using GIT Hooks

Here are the simple steps needed to create a deployment from your local GIT repository to a server based on this in-depth tutorial.

How it works

You are developing in a working-copy on your local machine, lets say on the master branch. Most of the time, people would push code to a remote server like github.com or gitlab.com and pull or export it to a production server. Or you use a service like deepl.io to act upon a Web-Hook that's triggered that service.

@om2c0de
om2c0de / unsubmodule.md
Created September 2, 2020 09:06 — forked from ryaninvents/unsubmodule.md
Convert git submodule to regular directory

From Stack Overflow.

# Fetch the submodule commits into the main repository
git remote add submodule_origin git://url/to/submodule/origin
git fetch submodule_origin

# Start a fake merge (won't change any files, won't commit anything)
git merge -s ours --no-commit submodule_origin/master
@om2c0de
om2c0de / remove_sl_icon.sh
Created March 1, 2020 10:40 — forked from ulasozguler/remove_sl_icon.sh
Remove spotlight icon from menu bar.
cd /System/Library/CoreServices/Spotlight.app/Contents/MacOS
sudo cp Spotlight Spotlight.bak
sudo perl -pi -e 's|(\x00\x00\x00\x00\x00\x00\x47\x40\x00\x00\x00\x00\x00\x00)\x42\x40(\x00\x00\x80\x3f\x00\x00\x70\x42)|$1\x00\x00$2|sg' Spotlight
cmp -l Spotlight Spotlight.bak
sudo codesign -f -s - Spotlight
sudo killall Spotlight
@om2c0de
om2c0de / json_schemed_field.py
Created January 30, 2020 12:45 — forked from Bahus/json_schemed_field.py
Django JSONField with Pydantic schema support
from functools import partial
import pydantic
import logging
from django.contrib.postgres.fields import JSONField
from typing import Type, Union, Tuple
from django.core.serializers.json import DjangoJSONEncoder