Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@ericoporto
ericoporto / magnetpimission.sh
Last active March 17, 2016 00:41
Script to download Magnets I click on my browser, remotely, on my Raspberry Pi
#!/bin/bash
# This script assumes you have a Raspberry Pi (or other always on server) running
# a Transmission-Daemon. It allows you to download you Magnet torrents on it, from
# yours PC browser (Firefox on Linux) on it, remotely. Save it as executable on
# your script folder, such as /usr/local/sbin .
# Open Firefox and in the address bar type:
# about:config
# There, right click anywhere to create a new boolean entry (New->Boolean) called:
# network.protocol-handler.expose.magnet
# Set it's value as false.
@ericoporto
ericoporto / lowercasefiles.sh
Last active October 28, 2015 20:55
Really simple bash script to rename all files in current directory to lower case. Ex: File-Name.mD becomes file-name.md .
#!/bin/bash
#lower case all files in running directory
for file in *
do
lowercase=`echo $file | tr '[A-Z]' '[a-z]'`
mv "$file" "$lowercase"
done
@ericoporto
ericoporto / pinsched.sh
Created November 1, 2015 17:23
Turn a pin from Raspberry on at a time for a duration period.
#!/bin/bash
# call using ./pinsched <time> <duration> <pin number>
# example: ./pinsched 14:00 2hours 5
timeat="$1"
duration="$2"
ledpim="$3"
endtime=`date +%H:%M -d " $timeat today + $duration"`
@ericoporto
ericoporto / md2docx.bat
Last active February 19, 2016 20:04
Drag and drop markdown to docx converter, for use with Windows. Example: http://i.imgur.com/sDjj5ty.gif
@ECHO OFF
REM Drag and drop markdown to docx converter
REM ========================================
REM This script requires PANDOC to be installed.
REM
REM Usage
REM -----
REM In Windows Explorer, drag a .md file on top of this script.
REM You can also call this script using:
REM md2docx.bat filename.md
@ericoporto
ericoporto / maketimelapse
Created March 3, 2016 18:36
Just so I can remember the command line I used to get no green artifacts
ffmpeg -start_number 1 -i IMG%04d.png -vf "scale=1920:1080" -b:v 8000k video.mp4
@ericoporto
ericoporto / cropimgs.bat
Created March 3, 2016 18:38
Just so I can remember how I batch cropped a lot of images
@echo off
for %%f in (*.png) do (
echo %%~nf
convert.exe "%%~nf.png" -gravity center -crop 2592x1458+0-84 +repage "..\out3\%%~nf.png"
)
@ericoporto
ericoporto / playmusic.desktop
Created March 27, 2016 22:51
Ubuntu shortcut to load ncmpcpp connected to mpd on my local server.
[Desktop Entry]
Version=0.1
Name=MPDC
Comment=Connect to MPD Server
Exec=gnome-terminal --geometry=48x16 -e "bash -c \"/usr/bin/ncmpcpp -h 192.168.0.3; exec bash\""
Terminal=true
Type=Application
Categories=Application;
@ericoporto
ericoporto / checkinternet.sh
Created April 12, 2016 22:51
Let your computer tell you when your internet is back on. Bash script that requires cron and espeak.
#!/bin/bash
# Requires: espeak, crontab, mktemp.
#
# Script for checking if this computer is connected to internet.
# If you copy it to $installdir, give this script execution permission.
# And remember to set proper ownership (using chown).
# Use Example:
#
# sudo chmod +x checkinternet.sh
# sudo cp checkinternet.sh /usr/local/sbin/
@ericoporto
ericoporto / statcolormap.m
Created April 22, 2016 17:32
Nice colormap for octave (that matches Statistica)
shading flat#
map = [[0, 110, 49]/255,
[0, 152, 19]/255,
[0, 212, 0]/255,
[49, 255, 0]/255,
[203, 255, 0]/255,
[255, 239, 0]/255,
[255, 121, 0]/255,
[255, 1, 0]/255,
[197, 0, 0]/255,
@ericoporto
ericoporto / virtualboxubuntu.md
Created May 6, 2016 13:47
Reminder on how to activate USB devices on Virtualbox, in Ubuntu.

If you ever need to use Virtual Box with USB and VT-d on Ubuntu, I recommend installing Users and Groups.

sudo apt-get install gnome-system-tools

Than open it

Select the user which will run Virtual Box.