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
# 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 / 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"
@ozscosta
ozscosta / reset_autoincrement.sh
Last active November 6, 2020 18:58 — forked from abhinavlal/reset_autoincrement.sh
[Reset mysql autoincrement keys] Reset auto increment of all tables in a mysql database
mysql -Nsr -e "SELECT t.table_name FROM INFORMATION_SCHEMA.TABLES t WHERE t.table_schema = 'DB_NAME'" | xargs -I {} mysql DB_NAME -e "ALTER TABLE {} AUTO_INCREMENT = 1;"
@ozscosta
ozscosta / HttpStatusCode.ts
Created October 1, 2020 23:27 — forked from scokmen/HttpStatusCode.ts
Typescript Http Status Codes Enum
"use strict";
/**
* Hypertext Transfer Protocol (HTTP) response status codes.
* @see {@link https://en.wikipedia.org/wiki/List_of_HTTP_status_codes}
*/
enum HttpStatusCode {
/**
* The server has received the request headers and the client should proceed to send the request body
@ozscosta
ozscosta / git-dmz-flow.md
Created August 14, 2019 21:02 — forked from djspiewak/git-dmz-flow.md
Git DMZ Flow

Git DMZ Flow

I've been asked a few times over the last few months to put together a full write-up of the Git workflow we use at RichRelevance (and at Precog before), since I have referenced it in passing quite a few times in tweets and in person. The workflow is appreciably different from GitFlow and its derivatives, and thus it brings with it a different set of tradeoffs and optimizations. To that end, it would probably be helpful to go over exactly what workflow benefits I find to be beneficial or even necessary.

  • Two developers working on independent features must never be blocked by each other
    • No code freeze! Ever! For any reason!
  • A developer must be able to base derivative work on another developer's work, without waiting for any third party
  • Two developers working on inter-dependent features (or even the same feature) must be able to do so without interference from (or interfering with) any other parties
  • Developers must be able to work on multiple features simultaneously, or at lea
@ozscosta
ozscosta / git-update-fork.sh
Created April 17, 2019 00:24 — forked from rdeavila/git-update-fork.sh
Git: como atualizar um fork com as mudanças do original?
#!/bin/bash
# Adicione um novo remote; pode chamá-lo de "upstream":
git remote add upstream https://github.com/usuario/projeto.git
# Obtenha todos os branches deste novo remote,
# como o upstream/master por exemplo:
git fetch upstream
@ozscosta
ozscosta / css-media-queries-cheat-sheet.css
Created September 26, 2018 02:51 — forked from bartholomej/css-media-queries-cheat-sheet.css
CSS Media Query Cheat Sheet (with Foundation)
/*------------------------------------------
Responsive Grid Media Queries - 1280, 1024, 768, 480
1280-1024 - desktop (default grid)
1024-768 - tablet landscape
768-480 - tablet
480-less - phone landscape & smaller
--------------------------------------------*/
@media all and (min-width: 1024px) and (max-width: 1280px) { }
@media all and (min-width: 768px) and (max-width: 1024px) { }
@ozscosta
ozscosta / commandline.txt
Last active August 30, 2018 21:41 — forked from sandervm/commandline.txt
Generate Django secret key commandline
python -c 'import random; result = "".join([random.choice("abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)") for i in range(50)]); print(result)'