Skip to content

Instantly share code, notes, and snippets.

View dublado's full-sized avatar
📭
Send me a Telegram

Thiago Machado dublado

📭
Send me a Telegram
View GitHub Profile
@dublado
dublado / vscode-macos-context-menu.md
Created October 5, 2022 18:22 — forked from idleberg/vscode-macos-context-menu.md
“Open in Visual Studio Code” in macOS context-menu

Open in Visual Studio Code

  • Open Automator
  • Create a new document
  • Select Quick Action
  • Set “Service receives selected” to files or folders in any application
  • Add a Run Shell Script action
    • your default shell should already be selected, otherwise use /bin/zsh for macOS 10.15 (”Catalina”) or later
    • older versions of macOS use /bin/bash
  • if you're using something else, you probably know what to do 😉
@dublado
dublado / minikube.md
Created September 26, 2022 16:36 — forked from rahulkumar-aws/minikube.md
Install/Uninstall Minikube from Mac
minikube stop; minikube delete
docker stop $(docker ps -aq)
rm -r ~/.kube ~/.minikube
sudo rm /usr/local/bin/localkube /usr/local/bin/minikube
systemctl stop '*kubelet*.mount'
sudo rm -rf /etc/kubernetes/
docker system prune -af --volumes
@dublado
dublado / Dropzone with Python 3
Created May 3, 2022 22:05 — forked from MichaelCurrie/ Dropzone with Python 3
Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
#Drag-and-drop upload files, via JavaScript, to a simple Python 3 HTTP server
@dublado
dublado / admin.py
Created April 30, 2022 23:06 — forked from daimon99/admin.py
Django admin different changeform in add / change。Django Admin新增与修改页面使用不同的Form。
@admin.register(m.Holiday)
class HolidayAdmin(admin.ModelAdmin):
list_display = ('id', 'day', 'category')
search_fields = ('day',)
list_filter = ('category',)
date_hierarchy = 'day'
def get_form(self, request, obj=None, change=False, **kwargs):
if not change:
@dublado
dublado / admin.py
Created April 29, 2022 13:06 — forked from StasKoval/admin.py
AdminImageWidget
from django.contrib import admin
from django.db import models
from django.contrib import admin
from django.forms import forms
from django.utils.safestring import mark_safe
from django.contrib.admin.widgets import AdminFileWidget
from models import Service, Client, Proyect, Image, Country,LineAction
from cms.plugins.text.widgets.wymeditor_widget import WYMEditor
from sorl.thumbnail.admin import AdminInlineImageMixin
@dublado
dublado / admin.py
Created April 28, 2022 20:41 — forked from alexisskodak/admin.py
DJANGO ADMIN Basic ModelAdmin override example django admin
from .models import Post, Picture
from .forms import PostForm
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
list_display = ('title',)
add_form_template = 'admin/post_form.html'
change_form_template = 'admin/post_form.html'
def get_form(self, request, obj=None, **kwargs):
@dublado
dublado / admin.py
Created April 28, 2022 20:40 — forked from alexisskodak/admin.py
DJANGO ADMIN Add_view, save_model, and change_view override example django admin
from .models import Post, Picture
from .forms import PostForm
@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
...
def add_view(self, request, form_url="", extra_context=None):
extra_context = extra_context or {}
@dublado
dublado / Knex-Migrations-Seeding.md
Created March 27, 2022 18:44 — forked from NigelEarle/Knex-Migrations-Seeding.md
Migration and seeding instructions using Knex.js!

Migrations & Seeding

What are migrations??

Migrations are a way to make database changes or updates, like creating or dropping tables, as well as updating a table with new columns with constraints via generated scripts. We can build these scripts via the command line using knex command line tool.

To learn more about migrations, check out this article on the different types of database migrations!

Creating/Dropping Tables

# download the docker installation script
curl -fsSL https://get.docker.com -o get-docker.sh
# I prefer to have a brief look at the contents of such scripts
# this is optional - as long as you trust the source
# vim get-docker.sh
# finally run the installation
chmod +x get-docker.sh
./get-docker.sh
@dublado
dublado / gist:15f594fbc959b589fcc7bfe7443e469d
Created February 24, 2022 23:57 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f
adb tcpip 5555
adb connect 192.168.0.101:5555
https://android-doc.github.io/tools/help/shell.html