Skip to content

Instantly share code, notes, and snippets.

View ilosamart's full-sized avatar

Fábio Tramasoli ilosamart

View GitHub Profile
@ilosamart
ilosamart / eternal.py
Last active March 7, 2024 20:17
eternal.py
import subprocess
from threading import Timer
# main, but I'm lazy
with subprocess.Popen(['bash', 'eternal.sh'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8') as proc:
try:
timer = Timer(5, proc.kill)
timer.start()
for line in proc.stdout:
print(f'>> {line.strip()}')
@ilosamart
ilosamart / pdfoptim.sh
Created April 27, 2023 22:15 — forked from slowkow/pdfoptim.sh
Optimize PDF files with Ghostscript.
#!/usr/bin/env bash
# pdfoptim.sh
#
# Optimize a PDF with Ghostscript
#
# Usage
# -----
#
# bash pdfoptim.sh input.pdf output.pdf
#
@ilosamart
ilosamart / simple_oracle.py
Last active July 23, 2021 22:50
simple_oracle.py
class MinhaClasseBonita:
#...
@classmethod
async def get_one(cls, oracle_pool, **kargs ):
retval = {}
async with oracle_pool.acquire() as connection:
async with connection.cursor() as cursor:
# retorna dicts
sql_stmt = cls.get_sql()
@ilosamart
ilosamart / cooldecode.sh
Created June 16, 2021 14:58
Encode / Decode text - ideia ctrl-chupada descaradamente do linkedin do João
# ref.: https://unix.stackexchange.com/questions/98948/ascii-to-binary-and-binary-to-ascii-conversion-tools
#decode
echo "$@" | base64 -d | zcat | perl -lape '$_=pack"(B8)*",@F'
@ilosamart
ilosamart / docker-registry-cleanup.sh
Created April 25, 2019 13:26
clean a docker registry
#!/bin/bash
############################################################
# Limpa 'docker registry' (últimas 2 imagens ficam)
############################################################
# esse carinha depende do https://github.com/dominictarr/JSON.sh
REGISTRY_URL=${1:-http://localhost:8082}
REGISTRY_DATA_VOLUME=${2:-/var/www/docker-registry-data}
@ilosamart
ilosamart / docker_debugging.md
Created March 15, 2019 14:40 — forked from veuncent/docker_debugging.md
Debugging Django apps running in Docker using ptvsd - Visual Studio (Code)

Remote debugging in Docker (for Django apps)

In order to enable debugging for your Django app running in a Docker container, follow these steps using Visual Studio (Code):

  1. Install ptvsd:
pip install ptvsd
  1. To your launch.json, add this:
Pré-história:
Unix:
1970 - Bell Labs., por Ken Thompson, Dennis Ritchie (os mesmos da linguagem C :)
1983 - UNIX System V (pronounced: "System Five") is one of the first commercial versions of the Unix operating system. It was originally developed by AT&T.
Microsoft:
1975, April 4 - Bill Gates & Paul Allen
1976 - Open Letter to Hobbyists (Bill Gates): (Why is this? As the majority of hobbyists must be aware, most of you steal your software. Hardware must be paid for, but software is something to share. Who cares if the people who worked on it get paid?) http://www.lettersofnote.com/2009/10/most-of-you-steal-your-software.html
BASIC interpreters for the Altair 8800
Licensed MS-DOS 1.10/1.14 to IBM, who, in August 1981, offered it as PC DOS 1.0 as one of three operating systems[13] for the IBM 5150, or the IBM PC
@ilosamart
ilosamart / install_pytho27.sh
Created March 12, 2018 20:34 — forked from ftao/install_pytho27.sh
install python 2.7 on debian 6
#!/bin/sh
mkdir ~/down/
cd ~/down/
sudo apt-get install build-essential
wget http://www.python.org/ftp/python/2.7.2/Python-2.7.2.tgz
tar -xzf Python-2.7.2.tgz
cd Python-2.7.2
sudo apt-get install libsqlite3-dev zlib1g-dev libncurses5-dev
sudo apt-get install libgdbm-dev libbz2-dev libreadline5-dev
sudo apt-get install libssl-dev libdb-dev
@ilosamart
ilosamart / .gitconfig
Created January 12, 2018 15:17
Git change SSH to HTTP :)
[url "https://github.com/"]
insteadOf = git@github.com/
[url "https://github.com/"]
insteadOf = git://github.com/
@ilosamart
ilosamart / README
Created January 5, 2018 17:47
Termux basic apps install
Install Termux and SSHDroid ;)