Skip to content

Instantly share code, notes, and snippets.


Daniel Gonçalves danielgoncalves

  • Base4 Sistemas
  • Catanduva/SP
  • Twitter @spanazzi
View GitHub Profile
danielgoncalves /
Created Jan 29, 2022 — forked from gottadiveintopython/ が更新されたようなので試してみた
from import runTouchApp
from kivy.lang import Builder
from kivy.uix.button import Button
from import (
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
RotateTransition, TileTransition, FastSlideTransition,
PixelTransition, RippleTransition, BlurTransition, RVBTransition,
danielgoncalves /
Created Jan 17, 2022 — forked from tshirtman/
Making a simple responsive app layout.
from import App
from kivy.lang import Builder
from import OptionProperty
from kivy.core.window import Window
from kivy.factory import Factory
KV = '''
#:import A kivy.animation.Animation

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. :-)


danielgoncalves /
Last active Oct 9, 2020 — forked from jsbueno/
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)])
danielgoncalves /
Created Feb 21, 2020 — forked from emmanueltissera/
Generate a git patch for a specific commit

Creating the patch

git format-patch -1 <sha>
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 /
Created Jan 22, 2020 — forked from Kartones/
PostgreSQL command line cheatsheet


Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
View singleton_way_to_go.dart
// (!) This implementation seems to work;
// Trying this in DartPad results in "s = false" and "f = true" as expected.
// This was taken from
class FooBar {
static final FooBar _instance = new FooBar._internal();
factory FooBar() => _instance;
FooBar._internal() {
// initialization logic here
danielgoncalves /
Created Apr 23, 2018 — forked from luxinyan/
Generate barcode with reportlab.
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
from reportlab.lib.units import mm
#I"ll be generating code39 barcodes, others are available
from import code39
# generate a canvas (A4 in this case, size doesn"t really matter)
# create a barcode object
# (is not displayed yet)
danielgoncalves /
Last active Nov 23, 2017 — forked from dankrause/
Simple socket IPC in python
# Copyright 2017 Dan Krause
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
danielgoncalves /
Created Jan 11, 2017 — forked from mkropat/
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)