Skip to content

Instantly share code, notes, and snippets.

View onlurking's full-sized avatar
:shipit:
ship it

Diogo Felix onlurking

:shipit:
ship it
View GitHub Profile
@onlurking
onlurking / slideshare-dl.py
Last active October 20, 2019 02:33
An Slideshare Presentation Downloader written with Python 3 and Insomnia, now only requires img2pdf and BeautifulSoup.
import argparse
import urllib.request
import os
import img2pdf
from os import walk
from os.path import join
from bs4 import BeautifulSoup
work_dir = os.path.dirname(__file__)
@onlurking
onlurking / cleverbot.py
Created July 17, 2015 12:31
Cleverbot <-> Facebook Chat, dependencies are sleekxmpp and https://github.com/pierredavidbelanger/chatter-bot-api/, but sadly Facebook deprecated the Chat API, the code doesn't work as expected.
import sleekxmpp
import logging
from chatterbotapi import ChatterBotFactory, ChatterBotType
factory = ChatterBotFactory()
bot1 = factory.create(ChatterBotType.CLEVERBOT)
bot1session = bot1.create_session()
logging.basicConfig(level=logging.DEBUG)
@onlurking
onlurking / slide-dl.py
Created July 31, 2015 19:51
Python 3 port, PEP8 compliant and up to date version of https://github.com/erinus/slidesaver.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
# pip3 install pyquery requests reportlab
import json
import pyquery
import re
import requests
import reportlab.lib.utils
@onlurking
onlurking / fractal-plan.py
Last active August 29, 2015 14:27
Python3 port of Fractal-Plan (https://github.com/ryukinix/fractal-plan), to run you must install the latest version of pygame(https://bitbucket.org/pygame/pygame/downloads#branch-downloads) using python 3.
import pygame
from pygame.locals import QUIT, KEYDOWN, K_ESCAPE, K_RETURN, \
K_TAB, K_BACKSPACE, K_UP, K_LEFT, K_DOWN, K_RIGHT, K_EQUALS, K_MINUS
from math import sqrt, cos, sin, pi
from random import randint as random
from random import shuffle
from os import listdir
from os.path import join, isdir, isfile, expanduser
from mimetypes import guess_type
@onlurking
onlurking / 2048.py
Last active November 4, 2018 18:57
Python 3 port and PEP8 compliant version of David Sousa's 2048 game, to run install the latest version of pygame with python 3: https://bitbucket.org/pygame/pygame/get/default.zip, original source: https://github.com/davidsousarj/2048py/blob/master/2048py.py
# 2048.py
# Written in python / pygame by DavidSousaRJ - david.sousarj@gmail.com
# License: Creative Commons
# Sorry about some comments in portuguese!
import os
import sys
import pygame
from pygame.locals import *
from random import randint
from selenium import webdriver
from bs4 import BeautifulSoup, SoupStrainer
from time import sleep
browser = webdriver.Chrome()
browser.get("https://volafile.io/r/kUFzLJ")
sleep(4)
element = browser.find_element_by_tag_name("div")
@onlurking
onlurking / init.vim
Created April 7, 2016 18:57
My vimrc
"
" ███████████████████████████
" ███████▀▀▀░░░░░░░▀▀▀███████
" ████▀░░░░░░░░░░░░░░░░░▀████
" ███│░░░░░░░░░░░░░░░░░░░│███
" ██▌│░░░░░░░░░░░░░░░░░░░│▐██
" ██░└┐░░░░░░░░░░░░░░░░░┌┘░██
" ██░░└┐░░░░░░░░░░░░░░░┌┘░░██
" ██░░┌┘▄▄▄▄▄░░░░░▄▄▄▄▄└┐░░██
" ██▌░│██████▌░░░▐██████│░▐██
@onlurking
onlurking / gist:b8b0f528a76fea11496af52be01fac91
Created June 28, 2016 12:35
DevEnv Shellscript - Draft
#!/usr/bin/env bash
function exists { hash $1 2>/dev/null; }
function !exists { hash $1 >/dev/null 2>&1; }
function elevate{
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi