Skip to content

Instantly share code, notes, and snippets.

View faelp22's full-sized avatar
🏠
Working from home

Isael Sousa faelp22

🏠
Working from home
View GitHub Profile
@zulhfreelancer
zulhfreelancer / show-all-docker-build-logs.md
Created June 1, 2023 08:25
How to show all `docker build` logs?

How to show all docker build logs?

docker build -t YOUR-USER-NAME/YOUR-REPO:<YOUR-IMAGE-TAG> --no-cache --progress=plain .
@kingand
kingand / gist:ff301bc5b740abb43cd69350d9578d9d
Last active October 28, 2024 22:02
GPU-Enabled Docker Container on Windows 11

GPU-Enabled Docker Container (Linux) on Windows 11 (WSL)

Assumptions

  1. Windows 11 running Windows Subsystem for Linux (WSL) version 2 with Debian 11
  2. NVidia Windows 11 driver installed
  3. No need to install NVidia Linux driver within WSL (source)

Prerequisites

  1. Open the Debian terminal (e.g., launch Debian from Windows menu)
  2. Perform distribution update/upgrade
@bearlike
bearlike / clear_systemd_journal_logs.md
Created March 8, 2022 07:59
Clear Systemd Journal Logs in Ubuntu 20.04

Clear Systemd Journal Logs in Ubuntu 20.04

Systemd has its own logging system called the journal, and the log files are stored in /var/log/journal.

Check current disk usage of journal files

sudo journalctl --disk-usage

Rotate journal files

  • Active journal files will be marked as archived, so that they are never written to in future.
@rponte
rponte / using-uuid-as-pk.md
Last active March 10, 2025 16:29
Não use UUID como PK nas tabelas do seu banco de dados

Pretende usar UUID como PK em vez de Int/BigInt no seu banco de dados? Pense novamente...

TL;TD

Não use UUID como PK nas tabelas do seu banco de dados.

Um pouco mais de detalhes

@bradtraversy
bradtraversy / django_deploy.md
Last active March 13, 2025 16:50
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.

@fmasanori
fmasanori / juizes_que_mais_atuaram.py
Last active July 10, 2017 02:26
Juizes que mais atuaram segundo o site da CBF
from pdfminer.pdfinterp import PDFResourceManager, process_pdf
from pdfminer.converter import TextConverter
from pdfminer.layout import LAParams
from io import StringIO
from io import open
from urllib.request import urlopen
from bs4 import BeautifulSoup
import csv
@rg3915
rg3915 / export_excel_xlwt.py
Created April 26, 2017 14:53
Export Excel with xlwt
import xlwt
def export_xls(model_='User', file_name='export.xls', queryset=None, columns_=None):
response = HttpResponse(content_type='application/ms-excel')
response['Content-Disposition'] = 'attachment; filename="%s"' % file_name
wb = xlwt.Workbook(encoding='utf-8')
ws = wb.add_sheet(model_)
@slavafomin
slavafomin / ForcedLogoutListener.php
Last active September 4, 2022 17:59
Logging user out of Symfony 2 application using kernel event listener
<?php
namespace App\Security;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\SessionInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\Routing\RouterInterface;
use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
@denji
denji / nginx-tuning.md
Last active April 17, 2025 07:26
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@vmihailenco
vmihailenco / proxy.go
Created November 20, 2011 15:22
Simple TCP proxy in Golang
package main
import (
"bytes"
"encoding/hex"
"flag"
"fmt"
"io"
"log"
"net"