Skip to content

Instantly share code, notes, and snippets.

View om2c0de's full-sized avatar
🖋️
Innovating

Alexandr Skripkin om2c0de

🖋️
Innovating
View GitHub Profile
@Bahus
Bahus / json_schemed_field.py
Last active November 15, 2023 10:12
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
@lucabelluccini
lucabelluccini / rpi4.boot-from-sd-rootfs-on-usb.md
Last active October 13, 2023 12:38
Raspberry Pi 4 - Boot from SD, Rootfs on USB

Raspberry 4B - Boot from SD and rootfs on USB

Update

RPi4 now supports booting directly from USB. First update to get an eeprom which supports USB Boot, then configure the bootloader to boot from USB.

Original guide

  1. Download Raspbian from the official site
@pich4ya
pich4ya / docker_context.txt
Created February 16, 2019 22:53
How to fix "ERROR: No build stage in current context"
Problem:
$ docker-compose up --build
Building xxx
ERROR: No build stage in current context
Analysis:
Dockerfile
@dolang
dolang / kivy_asyncio_example.py
Created May 28, 2018 15:46
Kivy with an asyncio EventLoop example
"""
Kivy asyncio example app.
Kivy needs to run on the main thread and its graphical instructions have to be
called from there. But it's still possible to run an asyncio EventLoop, it
just has to happen on its own, separate thread.
Requires Python 3.5+.
"""
@kmpm
kmpm / adding-pixel-to-raspbian-lite.md
Last active March 23, 2024 19:31
Adding PIXEL to Raspbian Lite

Adding PIXEL/GUI to Raspbian Lite

These 'notes' were primarily intended for my own consumption but since there have been surprisingly many comments to it over the years I wanted to do some updates and clarifications. Thanks for all comments.

These instructions will require you to have connection to internet from your pi, WiFi, Ethernet or by some other means like a 3G USB dongle or something.

Preparations

@zmts
zmts / tokens.md
Last active May 2, 2024 15:03
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@ulasozguler
ulasozguler / remove_sl_icon.sh
Created February 4, 2017 18:58
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
@hum-n
hum-n / Civic.terminal
Last active June 4, 2022 10:59
macOS Terminal theme based on Civic Xcode 8 theme (WWDC 2016 colors)
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>ANSIBlackColor</key>
<data>
YnBsaXN0MDDUAQIDBAUGFRZYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3AS
AAGGoKMHCA9VJG51bGzTCQoLDA0OVU5TUkdCXE5TQ29sb3JTcGFjZVYkY2xhc3NPECcw
LjE0NTA5ODAzOTIgMC4xNDkwMTk2MDc4IDAuMTg4MjM1Mjk0MQAQAYAC0hAREhNaJGNs
YXNzbmFtZVgkY2xhc3Nlc1dOU0NvbG9yohIUWE5TT2JqZWN0XxAPTlNLZXllZEFyY2hp
@noelboss
noelboss / git-deployment.md
Last active May 2, 2024 15:47
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.

@cecilemuller
cecilemuller / letsencrypt_2020.md
Last active April 15, 2024 02:19
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SLL rating)


Virtual hosts

Let's say you want to host domains first.com and second.com.

Create folders for their files: