Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
# This is a really old post, in the comments (and stackoverflow too) you'll find better solutions.
def find(key, dictionary):
for k, v in dictionary.iteritems():
if k == key:
yield v
elif isinstance(v, dict):
for result in find(key, v):
yield result
elif isinstance(v, list):
@douglasmiranda
douglasmiranda / gist:e5bd76d0b85a95f74b38b94528c52910
Created July 24, 2017 06:21
Fix: dpkg: error: cannot remove architecture X currently in use by the database
# You try:
sudo dpkg --remove-architecture armhf
# and get:
# dpkg: error: cannot remove architecture 'armhf' currently in use by the database
# So you have to remove the armhf packages installed to be able to `dpkg --remove-architecture armhf`
apt-get remove --purge `dpkg --get-selections | grep armhf | awk '{print $1}'`
# Then:
sudo dpkg --remove-architecture armhf
# SUCCESS!!!
@douglasmiranda
douglasmiranda / gist:aa171323de9711b8344efdb96d9d822d
Created September 14, 2023 01:14
Fix Virtualbox USB not detected
Virtual box cant enumerate
Virtual box no usb devices detected
sudo usermod -aG vboxusers $USER
@douglasmiranda
douglasmiranda / nth_child_odd_even.css
Created October 7, 2011 16:39
Aplicar css em elementos pares em ímpares.
/* Example */
/* Par */
ul li:nth-child(even){
background:#fff;
}
/* Ímpar */
ul li:nth-child(odd){
background:#000;
@douglasmiranda
douglasmiranda / instructions.md
Created July 19, 2018 05:51
Add email to Keybase.io PGP Key (Public Key)

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
@douglasmiranda
douglasmiranda / django-media-permissions.md
Last active May 16, 2023 10:33
Fix Django Media Folder Permissions

Check your current file/directory permission with:

stat -c "%a" /path/to/dir_or_file

To recursively give directories read&execute privileges:

find /path/to/base/dir -type d -exec chmod 755 {} +
@douglasmiranda
douglasmiranda / ubuntu-dell-g3.md
Last active March 2, 2023 21:16
Ubuntu 16.04 Dell G3 series setup
@douglasmiranda
douglasmiranda / Dockerfile
Created January 24, 2023 23:14
Python Pillow build on Alpine
FROM python:3.11-alpine3.17
ENV PATH=$PATH:$HOMEAPP/.local/bin
ENV PYTHONPATH=$HOMEAPP:$PROJECT_NAME
# Python packages build dependencies
RUN apk add --no-cache --virtual .build-dependencies \
# Essentials
gcc musl-dev openssl-dev openssl \
# Pillow / PIL build dependencies
@douglasmiranda
douglasmiranda / toasts.css
Last active December 8, 2022 19:29
Bootstrap Toasts - Top Right Fixed (+ Fix toast-container overlaping content)
/* https://getbootstrap.com/docs/5.0/components/toasts/ */
.toast-container {
position: fixed;
right: 20px;
top: 20px;
}
.toast:not(.showing):not(.show) {
display: none !important;