Skip to content

Instantly share code, notes, and snippets.

View ozscosta's full-sized avatar
🌴
Developmeting

Ozeias Costa ozscosta

🌴
Developmeting
  • Codefuture
  • Palmas, BRA
View GitHub Profile
@ozscosta
ozscosta / fileresponseutils.py
Created August 13, 2024 00:55 — forked from HeinrichWizardKreuser/fileresponseutils.py
Django FIleResponse helpers
from django.http import FileResponse
from io import BufferedReader, BytesIO
def file_response_from_str(content: str, filename: str) -> FileResponse:
""" Serves a file response from the given string
Args:
content: str
@ozscosta
ozscosta / fibonnaci-1.py
Created December 29, 2023 13:19
Fibbonaci in python
class Fibonacci:
def __init__(self, first: int = 1):
self.curr = 1
self.last = 0
while self.value < first:
self.__next__()
@property
def value(self) -> int:
return self.curr + self.last
@ozscosta
ozscosta / isPalindrome.kt
Created December 27, 2023 16:38
Check is palindrome in Kotlin
fun isPalindrome(x: Int): Boolean
{
if (x < 0) return false
val x = x.toString()
var left = 0;
var right = x.length - 1;
while (left < right)
# Salvar num arquivo ~/encode.sh, conceder direito de execução e
# executar desta forma (adaptar nomes de diretórios e arquivos para seu caso):
# $ ~/encode.sh ~/Video/bigFile.mp4 ~/Video/smallFile.mp4
ffmpeg -i "$1" -vcodec h264 -acodec aac "$2"
@ozscosta
ozscosta / linkedin.js
Created February 4, 2022 21:38 — forked from CViniciusSDias/linkedin.js
Aceitar todos os convites do LinkedIn
document
.querySelectorAll('button[aria-label^="Aceitar o convite de"]')
.forEach((btn, i) => setTimeout(() => btn.click(), i + 500));
@ozscosta
ozscosta / keyboard-config.sh
Last active May 7, 2022 12:03
Configurar teclado no wslg para qwerty pt-br
#!/bin/bash
# first step, configure your locale
sudo dpkg-reconfigure locales
# on the screen scroll down and choose pt_BR.UTF8
# then next you will do ok and ok, and run this on the command line
sudo update-locale LANG=pt_BR.UTF8
# in the end you run this
setxkbmap -model abnt2 -layout br -variant abnt2
# and don't restart WSL yet, just try...
@ozscosta
ozscosta / pgsql.sql
Created June 6, 2021 03:39
Tamanho do banco pgsql
select
-- table_name,
-- pg_size_pretty( pg_total_relation_size(quote_ident(table_name))),
-- pg_size_pretty(sum(pg_total_relation_size(quote_ident(table_name))))
pg_size_pretty(sum(pg_total_relation_size(quote_ident(table_name))))
from information_schema.tables
where
table_schema = 'public'
-- order by pg_total_relation_size(quote_ident(table_name)) desc
@ozscosta
ozscosta / divisao-com-subtracao.c
Last active June 6, 2021 03:30
Divisão apenas com subtração
#include <stdio.h>
int main() {
int dividendo;
int divisor;
int resultado = 0;
int resto = 0;
printf("Dividendo: ");
;(function () {
'use strict';
$.plugins = $.plugins || {};
$.plugins.confirm = function () {
// -----------------------------------------------------------------------------------
// possibilidades de uso:
//
// 1 -> mensagem 'mensagem'
@ozscosta
ozscosta / install.sh
Created March 26, 2021 17:30 — forked from wdullaer/install.sh
Install Latest Docker and Docker-compose on Ubuntu
# Ask for the user password
# Script only works if sudo caches the password for a few minutes
sudo true
# Install kernel extra's to enable docker aufs support
# sudo apt-get -y install linux-image-extra-$(uname -r)
# Add Docker PPA and install latest version
# sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
# sudo sh -c "echo deb https://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list"