Skip to content

Instantly share code, notes, and snippets.

View douglasmiranda's full-sized avatar
👽

Douglas Miranda douglasmiranda

👽
  • Earth, Brazil
View GitHub Profile
https://github.com/so-fancy/diff-so-fancy/
https://github.com/paulirish/git-open
@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:2cc280b1bc2b1ec1f4c0b9d22729982d
Created July 21, 2017 23:48
Fix: can't open /dev/ttys0 no such file or directory on boot - Linux Alpine on Raspberry Pi 3
# The workaround is to disable BT by adding the following to config.txt:
dtoverlay=pi3-disable-bt
# Source: https://raspberrypi.stackexchange.com/questions/45570/how-do-i-make-serial-work-on-the-raspberry-pi3
@douglasmiranda
douglasmiranda / gist:3864584fde2ad2d08fad00b5ef847c2c
Created July 21, 2017 04:49
Error - wget on alpine - error getting response: Connection reset by peer [Fix]
ERROR:
wget https://bootstrap.pypa.io/get-pip.py
Connecting to bootstrap.pypa.io (151.101.56.175:443)
wget: error getting response: Connection reset by peer
FIX:
apk update
apk add ca-certificates
sudo /usr/local/sbin/resize_rootfs.sh
sudo /usr/local/sbin/pine64_update_kernel.sh
sudo /usr/local/sbin/pine64_update_kernel.sh
sudo /usr/local/sbin/pine64_update_uboot.sh
sudo /usr/local/sbin/pine64_fix_whatever.sh
sudo /usr/local/sbin/install_mate_desktop.sh
# if it fails when installing mate:
sudo dpkg --configure -a
@douglasmiranda
douglasmiranda / gist:801d6089148911e238613106af0c8822
Created March 11, 2017 07:09
Solution: OSX - Reduced Transparency after crashing / restarting
# Go to the terminal, type:
defaults read com.apple.universalaccess reduceTransparency
# If it returns 1, set false and reboot. Type:
defaults write com.apple.universalaccess reduceTransparency -bool FALSE
@douglasmiranda
douglasmiranda / example.html
Created February 11, 2017 21:56
Django Fine Uploader Example Template
<!--
Follow the instructions on our README:
https://github.com/douglasmiranda/django-fine-uploader#quickstart
Then you can use this html as an example.
If you are lazy, don't worry, we have a example project:
https://github.com/douglasmiranda/django-fine-uploader/tree/master/example
-->
<!DOCTYPE html>
@douglasmiranda
douglasmiranda / views.py
Created November 7, 2016 03:34
Django Atomic Requests + Background Jobs
# http://www.vinta.com.br/blog/2016/database-concurrency-in-django-the-right-way/
from django.db import transaction
# ...
class SimpleHandler(View):
def get(self, request, *args, **kwargs):
myData = Data.objects.create(name='Dummy')
transaction.on_commit(lambda: do_stuff.delay(myData.pk))
# Flash SD card
# https://github.com/hypriot/flash
sudo apt-get update
sudo apt-get upgrade
# udpdate firmware
sudo rpi-update
# deluge torrent
@douglasmiranda
douglasmiranda / default
Created May 3, 2016 22:56
Nginx: Make (PDF) file downloadable when accessed with parameter '?download=1'
# http://mysite.com/media/file.pdf
# absolute path: /path/to/media/directory/file.pdf
location /media {
alias /path/to/media/directory;
expires max;
access_log off;
location ~* \.(pdf)$ {
if ($arg_download = 1){
add_header Content-Disposition 'attachment;';
}