Skip to content

Instantly share code, notes, and snippets.

👽
Writing code from another galaxy.

Douglas Miranda douglasmiranda

👽
Writing code from another galaxy.
View GitHub Profile
View gist:5127251
# 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 / ubuntu-dell-g3.md
Last active Jul 18, 2020
Ubuntu 16.04 Dell G3 series setup
View ubuntu-dell-g3.md
@douglasmiranda
douglasmiranda / option1.py
Last active Jul 14, 2020
Fix: Django Debug Toolbar not showing when using with Docker.
View option1.py
# YOU MAY WANT TO CHECK THIS OUT: https://github.com/douglasmiranda/ddpt/blob/master/{{cookiecutter.django_project_name}}/{{cookiecutter.django_project_name}}/config/local.py
# If you don't do this you will have to add the host IP in INTERNAL_IPS = ('127.0.0.1',)
# And it will change, then you will have to change INTERNAL_IPS again.
def show_toolbar(request):
if request.is_ajax():
return False
return True
@douglasmiranda
douglasmiranda / django-media-permissions.md
Last active Jun 29, 2020
Fix Django Media Folder Permissions
View django-media-permissions.md

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 / ansible.md
Last active May 21, 2020
Ansible: Notes, Errors and Solutions
View ansible.md

Ansible for Configuration Management

I'm using Ansible only for Configuration Management, the server is up and I want to configure users, install packages and configure them.

For infrastructure provisioning terraform.io is nice!

Currently, my deployment flow includes Drone.io/GitlabCI for CI/CD and Docker Swarm for orchestrating containers.

@douglasmiranda
douglasmiranda / drone.md
Created Nov 26, 2018
Status: how Drone deals with monorepo; dir/file changed conditions
View drone.md

Well there's no builtin way of doing.

The problem is:

We need a way of skipping steps, or conditional pipelines that are triggered when some dir/* files.* were changed since last commit.

Useful if you maintain a:

  • Monorepo
@douglasmiranda
douglasmiranda / core-os-install.md
Last active Apr 15, 2020
Installing CoreOS on my old laptop
View core-os-install.md
@douglasmiranda
douglasmiranda / pdf-to-svg.md
Last active Mar 26, 2020
About PDF to SVG converters
View pdf-to-svg.md

(Maybe in the future I will explain better about what happens when you convert your document to pdf, so for now, just keep the originals safe.)

The easy way

Depending on the PDFs you could just extract the text, with simple tools like pdftotext, comes with Poppler Tools.

Want to convert a simple page? You could just simply load some vector editing software, that accepts PDF as an input and export in SVG. Or maybe and online converter. A single document, not too large, you probably could choose this option also.

Not too easy way

@douglasmiranda
douglasmiranda / instructions.md
Created Jul 19, 2018
Add email to Keybase.io PGP Key (Public Key)
View instructions.md

Export your public key:

keybase pgp export > keybase-public.key

Export your private key:

keybase pgp export --secret > keybase-private.key
You can’t perform that action at this time.