Skip to content

Instantly share code, notes, and snippets.

deck -D build/root.build
deck -D build/bootstrap
rm -rf build/root.spec build/cdroot build/product.iso build/log build/stamps
deck /turnkey/fab/bootstraps/bullseye build/bootstrap
fab-apply-overlay /turnkey/fab/common/overlays/bootstrap_apt build/bootstrap;
fab-chroot build/bootstrap "echo nameserver 8.8.8.8 > /etc/resolv.conf";
fab-chroot build/bootstrap "echo nameserver 8.8.4.4 >> /etc/resolv.conf";
mkdir -p build/bootstrap/usr/local/share/ca-certificates/;
# temporarily allow cert to not exist
cp /usr/local/share/ca-certificates/squid_proxyCA.crt build/bootstrap/usr/local/share/ca-certificates/ || true;
@franklintimoteo
franklintimoteo / chroot-to-pi.sh
Created June 12, 2022 00:33 — forked from htruong/chroot-to-pi.sh
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
@franklintimoteo
franklintimoteo / organizer_downloads.py
Last active July 19, 2021 11:36
Organize your directory download moving files to the correct directory
import logging
import os
import glob
logging.basicConfig(level='DEBUG')
logger = logging.getLogger('organizer')
SO_IDENTIFY = os.name # posix nt java
logger.debug('Operating system %s' %SO_IDENTIFY)
@franklintimoteo
franklintimoteo / teststibiarequestdata.py
Last active July 6, 2021 14:05
Exemplo de como requisitar dados na api tibiadata. Busca todo conteúdo, caso retorne um código diferente de 200, ná próxima chamada irá fazer um nova tentativa. Caso retorne 200 irá manter os dados no closure
import unittest
from tibiarequestdata import request_highscores
class Testtibiatool(unittest.TestCase):
hash_request = []
def test_request_highscores(self):
"""Test invalid type world argument"""
result = 0
@franklintimoteo
franklintimoteo / file_get.py
Created September 1, 2019 20:58
Obter arquivo do servidor com progress bar
########### OPÇÃO 01
import requests
import sys
response = requests.get("https://checker.in/go/8819959", stream=True)
with open('file.apk', 'wb') as fileobj:
for chunk in response.iter_content(chunk_size=36):
fileobj.write(chunk)
@franklintimoteo
franklintimoteo / buscar_resultados_quina.py
Created August 29, 2019 00:17
Script solicitado por um membro do PyCoding, para buscar os resultados da quina no website da caixa.
"""
Conforme descrito pela biblioteca selenium
https://selenium-python.readthedocs.io/installation.html
Precisamos baixar o webdriver:
https://github.com/mozilla/geckodriver/releases
1 - Extrair
2 - Adicionar ao path
import click
from flask.cli import with_appcontext
from flask_sqlalchemy import SQLAlchemy
db = SQLAlchemy()
class Role(db.Model):
__tablename__ = 'roles'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(64), unique=True)
@franklintimoteo
franklintimoteo / _main.py
Created May 8, 2018 13:31
problem inherit Text
import logging
from asciimatics.screen import Screen
from asciimatics.scene import Scene
from asciimatics.widgets import Text, Frame, Layout
logger = logging.getLogger("my_test")
class TextDigit(Text):
@franklintimoteo
franklintimoteo / _main-03.py
Created May 4, 2018 15:13
Using staticmethod
from asciimatics.screen import Screen
from asciimatics.scene import Scene
from asciimatics.widgets import Layout, Frame, Button, Text
class TestView(Frame):
def __init__(self, screen):
super().__init__(screen,
screen.height * 2 // 3,
screen.width * 2 // 3,
reduce_cpu=True,
@franklintimoteo
franklintimoteo / _main-02.py
Created May 4, 2018 15:08
Validator with lambda
from asciimatics.screen import Screen
from asciimatics.scene import Scene
from asciimatics.widgets import Layout, Frame, Button, Text
class TestView(Frame):
def __init__(self, screen):
super().__init__(screen,
screen.height * 2 // 3,
screen.width * 2 // 3,
reduce_cpu=True,