Skip to content

Instantly share code, notes, and snippets.

Avatar

Maximiliano Churichi mchurichi

View GitHub Profile
View gist:f7338fe3bd13687e2600fa70a2055e1c
# On the host
```
# dnf install libtpms swtpm swtpm-tools
# modprobe tpm_vtpm_proxy
# mkdir /tmp/my_vtpm
# swtpm chardev --tpm2 --vtpm-proxy --tpmstate dir=/tmp/my_vtpm -d
New TPM device: /dev/tpm1 (major/minor = 253/1)
# container_id=$(mktemp)
@matthewlloyd
matthewlloyd / Flutter Development on Windows with IntelliJ and WSL.md
Last active Jan 28, 2023
Flutter Development on Windows with IntelliJ and WSL
View Flutter Development on Windows with IntelliJ and WSL.md

Developing Flutter apps using Windows

I've been developing Flutter apps for two years, and until this month did so exclusively on OS X. I decided to move my development environment entirely to Windows, troubled by Apple's recent behavior with the App Store, put off by being forced to buy an overpriced Mac to develop apps for iOS, and tired of wrestling with OS X's non-standard BSD-like Linux environment and Homebrew package manager. This document describes the various approaches I tried, and how to set up the one I liked the best.

@toransahu
toransahu / models.py
Last active Dec 11, 2022
Writable Nested Serializers | Multiple Images Upload | DRF
View models.py
#!/usr/bin/env python3.6.4
# coding="UTF-8"
__author__ = 'Toran Sahu <toran.sahu@yahoo.com>'
__copyright__ = 'Copyright (C) 2018 Ethereal Machines Pvt. Ltd. All rights reserved'
from django.db import models
from os import path
from utils import directory_path_with_id
View Meffeliar.md

Meffeliar

  • To fuck up. To Meffel it.

  • To be completely sure about something while being wrong at the same time. Subjects with this kind of tendency, frequently fall into believing they are right, and everyone else wrong. After an inmediate epiphany, where they realize this is not the case, they switch strategy and start acting as if since the very beginning they were saying the opposite.

  • A person who is able to deal with his shameful sins by doing the act of "reset". Reset involves going to church, and by doing so, achieving a new clean state. Make no mistake, this reset does not require penitence, as in the traditional catholic way. It provides a fresh start without any requirement, and can be used an unlimited amount of times.

  • To try to fuck someone up, but to end up fucking oneself up. Usually in a lame and notorious way.

@matthewbednarski
matthewbednarski / postal-codes.json
Last active Jan 19, 2023
Global postal codes regex formats
View postal-codes.json
[{ "Note": "The first two digits (ranging from 10–43) correspond to the province, while the last two digits correspond either to the city/delivery zone (range 01–50) or to the district/delivery zone (range 51–99). Afghanistan Postal code lookup", "Country": "Afghanistan", "ISO": "AF", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "With Finland, first two numbers are 22.", "Country": "Åland Islands", "ISO": "AX", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "Introduced in 2006, gradually implemented throughout 2007.", "Country": "Albania", "ISO": "AL", "Format": "NNNN", "Regex": "^\\d{4}$" }, { "Note": "First two as in ISO 3166-2:DZ", "Country": "Algeria", "ISO": "DZ", "Format": "NNNNN", "Regex": "^\\d{5}$" }, { "Note": "U.S. ZIP codes (range 96799)", "Country": "American Samoa", "ISO": "AS", "Format": "NNNNN (optionally NNNNN-NNNN or NNNNN-NNNNNN)", "Regex": "^\\d{5}(-{1}\\d{4,6})$" }, { "Note":
@obeattie
obeattie / db_utils.py
Created Oct 14, 2009
Exposes SQLAlchemy's sessions and transactions as context managers (so they will be managed automatically inside blocks), and also provides a transaction decorator, which wraps an entire function in a transaction
View db_utils.py
"""Utilities for managing database sessions."""
from __future__ import with_statement
import contextlib
import functools
@contextlib.contextmanager
def temp_session(session_cls, **kwargs):
"""Quick and dirty context manager that provides a temporary Session object
to the nested block. The session is always closed at the end of the block.