Skip to content

Instantly share code, notes, and snippets.

View eduardostalinho's full-sized avatar
🎱

Eduardo "Stalinho" Oliveira de Carvalho eduardostalinho

🎱
View GitHub Profile
@eduardostalinho
eduardostalinho / backup.md
Last active April 18, 2020 23:58
Backup & restore with borg

Backup & restore with borg.

Backup

sudo borg create --stats --compression lz4  --exclude '/home/*/.local/share/Trash' \
  --exclude '/home/*/.Trash' /backup/localbackup::{now:%Y-%m-%dT%H:%M:%S}  '/home/*/'

Restore

@eduardostalinho
eduardostalinho / prposta_de_regras.txt
Last active May 17, 2018 01:30
Proposta de regras para o grupo PythonParana no Telegra,
Regras:
- Se comunicar com respeito e consideração aos outros usuários.
- Não compartilhar conteúdo protegido por leis de direitos autorais.
- Não enviar nudes.
- Nao enviar porno.
- Não me invocar de 1 em 1 minuto.
- Não se passar por outra pessoa (fake).
- Evitar mensagens que não sejam de interesse comum do grupo.
- Falar do grupo para os coleguinhas.
@eduardostalinho
eduardostalinho / iching.ipynb
Created November 13, 2017 15:18
i Ching Powered by Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# -*- coding: utf-8 -*-
import argparse
import refine
parser = argparse.ArgumentParser()
parser.add_argument('source_file', metavar='SOURCE', type=str)
parser.add_argument('history_file', metavar='HISTORY_FILE', type=str)
parser.add_argument('dest_file', metavar='DESTINATION_FILE', type=str)

Keybase proof

I hereby claim:

  • I am eduardostalinho on github.
  • I am eduardostalinho (https://keybase.io/eduardostalinho) on keybase.
  • I have a public key whose fingerprint is ED10 0D02 DA67 42E3 EEF6 99F0 3E31 375C B508 A158

To claim this, I am signing this object:

# -*- coding: utf-8 -*-
import time, os, sys, asyncio
from collections import deque
import feedparser
class FeedBloom(object):
entries = deque()
_config_dir = os.path.join(os.environ.get('HOME'), '.config/feedbloom/')
feeds_file = os.path.join(_config_dir, 'feeds.txt')
@eduardostalinho
eduardostalinho / linear_interpolation.py
Created November 26, 2015 20:02
Liner interpolation in Python
def linear(point0, point1):
'''
More info at https://en.wikipedia.org/wiki/Linear_interpolation
>>> lin = linear((100, 9), (0, 100))
>>> lin(50)
54.5
'''
x0, y0 = point0
x1, y1 = point1
return lambda x: y0 + (y1 - y0) * ((x - x0) / (x1 -x0))
@eduardostalinho
eduardostalinho / konami-encrypt.js
Created May 12, 2015 09:46
Generate and encrypt and decrypt konami codes
var crypto = require('crypto'),
algorithm = 'aes-256-gcm',
password = 'my_precious',
// do not use a global iv for production,
// generate a new one for each encryption
iv = '6891jhiyfaskdfa';
var defaultLength = 10
var makePattern = function(length) {
# -*- coding: utf-8 -*-
from factory import create_app
if __name__ == '__main__':
app = create_app('configs/development.cfg')
app.run()
# -*- coding: utf-8 -*-
import os
from werkzeug import FileStorage
from utils.test import TestCase
from models import Campaign, MediaCategory, MediaResult, Investment
from forms import MediaPlanForm
class MediaPlanFormTestCase(TestCase):