This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# requires ansible 2.4 | |
# usage: | |
# ansible-playbook playbook.yml -i 192.168.1.254, | |
- hosts: all | |
gather_facts: false | |
tasks: | |
# ansible 2.4 telnet plugin does not add \r | |
# and the router requires it so... | |
- name: disable ipv6 in meo router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import pyaudio | |
import socket | |
import sys | |
FORMAT = pyaudio.paInt16 | |
CHANNELS = 1 | |
RATE = 44100 | |
CHUNK = 4096 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Watch log | |
# | |
# Script that will "tail -f" a log file and push the new lines to your phone | |
# using a Telegram bot (@PushItBot - https://fopina.github.io/tgbot-pushitbot/) | |
function pushit() { | |
# this function receives the first parameter passed to the script | |
# plus the latest line of the log file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Deps: | |
- pip install requests pafy youtube-dl | |
""" | |
import pafy | |
import requests | |
import string | |
import unicodedata | |
import re | |
from multiprocessing.pool import ThreadPool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
DIR=$(mktemp -d) | |
function setup_venv() { | |
cd $DIR | |
virtualenv env | |
. env/bin/activate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Scraper script for emuparadise.me | |
Usage | |
===== | |
``` | |
fopina$ ./emuparadise.py -h | |
usage: emuparadise.py [-h] [--download] [--search] [--system SYSTEM] [--list] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import urllib2 | |
import urllib | |
def qpushit(name, code, message): | |
data = urllib.urlencode({ | |
'name': name, | |
'code': code, | |
'sig': '', | |
'cache': False, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Sometimes we need to use a model in peewee that we want to get from DB or create if it doesn't exist. | |
We have get_or_create and create_or_get for that. | |
But what if it don't really want the instance of the model? We simply want to create it (for logging purposes maybe)? | |
Is there a faster method than these two, assuming we will be inserting a lot of duplicate records? | |
I usually simply do: | |
try: | |
Model.create(...) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
''' | |
pip install pysqlite | |
pip install unqlite | |
''' | |
import sqlite3 | |
from unqlite import UnQLite | |
import timeit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from urllib2 import Request, urlopen | |
import json | |
import sys | |
URL = 'https://api-v2launch.trakt.tv' | |
# create your own app | |
API_KEY = '' | |
SECRET = '' | |
PIN_URL = 'https://trakt.tv/pin/????' |