Skip to content

Instantly share code, notes, and snippets.

View rdenadai's full-sized avatar
🐍
But still haven't found what I'm looking for...

⟠ Rodolfo De Nadai rdenadai

🐍
But still haven't found what I'm looking for...
View GitHub Profile
@rdenadai
rdenadai / MyTelescopeSpeaks.py
Last active December 20, 2015 22:08
This is a small program i made using python to get an image from my telescope, using a webcam connected to the usb port, and post that on the twitter account i made!Was a really cool saturday afternoon project! hahahahahahahahahaha!
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from SimpleCV import *
from StringIO import *
from time import sleep
# I have to make a little alter on the default script api.py from tweepy since the guys didn't commit yet the update_with_media function
import tweepy
if __name__ == '__main__':
@rdenadai
rdenadai / installer.sh
Last active November 22, 2023 09:24
Super complex set of script and text files to build a full feature computer with a lots of python libs, java and other stuff like ffmpeg, opencv, llvm inside a vagrant script or linux install!!!
# The commands must be executed in the order bellow! Not doing this may break the installation!
# Install python-software-properties if you get a 'command not found'
# sudo apt-get install python-software-properties
# In case you need to install setuptools
# Keep in mind that doing this may destroy pip installation of setuptools
# Instead you can pip install setuptools ... :)
# wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
@rdenadai
rdenadai / edge_detection_and_polygon_exporter.py
Last active November 4, 2015 22:24
This gist uses Pillow to get the boundary edges of an image and generate the polygon position of the draw inside. Im using this script to get the polygon of my games sprites to create the collisions mechanics using libgdx!
from PIL import Image, ImageFilter
filename = "dship1"
image = Image.open(filename + ".png")
image = image.filter(ImageFilter.FIND_EDGES)
image.save(filename + "_edge.png")
cols = image.width
rows = image.height
points = []
@rdenadai
rdenadai / crop_image.py
Last active November 25, 2015 15:06
A simple command line python script which convert to grayscale and crop some image multiple times with the same size.
import sys, getopt
import argparse
from PIL import Image
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('-i', '--image')
parser.add_argument('-o', '--output')
parser.add_argument('-d', '--divisor')
args = parser.parse_args()
@rdenadai
rdenadai / torrents.py
Last active August 10, 2022 20:39
A simple python script that downloads a deezer playlist and bam! download magnetic files from pirate bay or monova and put on transmission torrent client... keep in mind that you need transmission to run this, open it and configure the remote option in preferences!
# DEPENDENCIES
# LINUX INSTALLS!
# apt-get install transmission firefox python-dev python-pip
# PYTHON LIBS NEED IT!
# pip install requests beautifulsoup4 transmissionrpc pyopenssl ndg-httpsclient pyasn1 selenium
import requests as req
import transmissionrpc
Install docker
wget -qO- https://get.docker.com/ | sh
Create a 'Dockerfile'
Inside the folder where the docker file is, create a image
docker build -t <img name> .
@rdenadai
rdenadai / esp826612e+micropython+commands
Created July 22, 2017 22:51
Simple explanation and usage of ESP8266 12E and MicroPython
# ESP8266 12E + MicroPython
## Install tools to connect to the board
pip install esptool ampy
apt install picocom
## Erase | Flash the firmware
esptool.py --port /dev/ttyUSB0 erase_flash
esptool.py --port /dev/ttyUSB0 --baud 460800 write_flash --flash_size=detect 0 esp8266-20170108-v1.8.7.bin
@rdenadai
rdenadai / ffmpeg.md
Created July 29, 2017 16:55
Using ffmpeg to extract audio from video files (this a copy of https://gist.github.com/protrolium/e0dbd4bb0f1a396fcb55)

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

Convert WAV to MP3, mix down to mono (use 1 audio channel), set bit rate to 64 kbps and sample rate to 22050 Hz:

abcde

A Better CD Encoder

Grab an entire CD and compress it to Ogg/Vorbis, MP3, FLAC, AAC, Ogg/Speex and/or MPP/MP+(Musepack) format.

Why abcde?

Ordinarily, the process of grabbing the data off a CD and encoding it, then tagging or commenting it, is very involved. abcde is designed to automate this. It will take an entire CD and convert it into a compressed audio format - Ogg/Vorbis, MPEG Audio Layer III, Free Lossless Audio Codec (FLAC), Ogg/Speex, MPP/MP+(Musepack), M4A (AAC) or Opus format(s). With one command, it will:

  • Do a CDDB or Musicbrainz query over the Internet to look up your CD or use a locally stored CDDB entry, or read CD-TEXT from your CD as a fallback for track information
@rdenadai
rdenadai / compare.sh
Last active November 8, 2023 12:58
Bash script which generate checksum from a list of dirs and files located inside a file.
#!/usr/bin/env bash
checksum() {
FILE=$1
if [ "$ALGO" = "SHA1" ]; then
sha1sum $FILE
else
md5sum $FILE
fi
}