Skip to content

Instantly share code, notes, and snippets.

View danielgoncalves's full-sized avatar

Daniel Gonçalves danielgoncalves

View GitHub Profile
@danielgoncalves
danielgoncalves / git-apply-patch.md
Created February 21, 2020 10:09 — forked from emmanueltissera/git-apply-patch.md
Generate a git patch for a specific commit

Creating the patch

git format-patch -1 <sha>
OR
git format-patch -1 HEAD

Applying the patch

git apply --stat file.patch # show stats.
git apply --check file.patch # check for error before applying

@danielgoncalves
danielgoncalves / sandbox.py
Last active July 8, 2020 03:21
PyESCPOS sandbox script
# -*- coding: utf-8 -*-
# Requires https://github.com/base4sistemas/pyescpos
# Have a look at https://github.com/base4sistemas/pyescpos/wiki
from __future__ import unicode_literals
from __future__ import print_function
import logging.config
from escpos import showcase
from escpos.conn.usb import USBConnection
@danielgoncalves
danielgoncalves / lazy_qs_demo.py
Last active October 9, 2020 14:16 — forked from jsbueno/lazyquicksort.py
Lazy sorter - an iterator that yields items in sorted order, lazily
import random
import string
from lazyquicksort import lazy_sort
def chars(length):
options = string.ascii_lowercase
return ''.join([random.choice(options) for i in range(length)])

Tested only on Ubuntu 20.04, KDE Neon User Edition (based on Ubuntu 20.04) and OSX Mojave.

will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get packages)

NOTE: Don't create a .sh file and run it all at once. It will not work. Copy, paste, and execute each command below manually. :-)

Ubuntu

# DO NOT RUN THIS AS A ROOT USER
@danielgoncalves
danielgoncalves / responsive_example.py
Created January 17, 2022 22:50 — forked from tshirtman/responsive_example.py
Making a simple responsive app layout.
from kivy.app import App
from kivy.lang import Builder
from kivy.properties import OptionProperty
from kivy.core.window import Window
from kivy.factory import Factory
KV = '''
#:import A kivy.animation.Animation
<RLabel@Label>:
@danielgoncalves
danielgoncalves / test_moretransitions.py
Created January 29, 2022 02:03 — forked from gottadiveintopython/test_moretransitions.py
kivy.garden.moretransitions が更新されたようなので試してみた
from kivy.app import runTouchApp
from kivy.lang import Builder
from kivy.uix.button import Button
from kivy.garden.moretransitions import (
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
RotateTransition, TileTransition, FastSlideTransition,
)
ALL_TRANSITIONS = (
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
@danielgoncalves
danielgoncalves / flow.json
Last active June 15, 2023 20:05
Node-RED Main Flow - E2PPT
[
{
"id": "a5f5fa2877f55e9a",
"type": "tab",
"label": "Main Flow",
"disabled": false,
"info": "",
"env": []
},
{