Skip to content

Instantly share code, notes, and snippets.

View diogopms's full-sized avatar
🏠
Working from home (🇵🇹)

Diogo Serrano diogopms

🏠
Working from home (🇵🇹)
View GitHub Profile
@diogopms
diogopms / videoinfo.js
Last active October 30, 2023 18:24
Get video information using ffprobe and url
var exec = require('child_process').exec
var url = 'https://URL'
var command =
'curl --silent ' + url + '| ffprobe pipe:0 -print_format json -show_format'
exec(command, function callback (error, stdout, stderr) {
if (stderr.indexOf('Invalid data') > -1) {
console.error('Error!')
}
@diogopms
diogopms / raspberry_pi_tools.md
Last active May 1, 2019 10:19
Raspberry PI tools

Raspberry PI

Disk utility

diskutil list

/dev/disk2
   #:                       TYPE NAME                    SIZE       IDENTIFIER
 0: FDisk_partition_scheme *32.0 GB disk2
@diogopms
diogopms / arp-scan.txt
Created September 20, 2015 20:00
find connected device
arp-scan 192.168.2.0/24 | grep 2c:be:08:8a:83:1b
@diogopms
diogopms / mysqldump_fix_utf8.sh
Last active February 18, 2018 17:46
Fix character-set utf8 mysqldump mysql
time mysqldump -uroot -p --skip-set-charset --default-character-set=latin1 -h HOST TABLE | sed 's/CHARSET=latin1/CHARSET=utf8/g' > dump.sql
time mysql -uroot -p --default-character-set=utf8 -h HOST TABLE < dump.sql
@diogopms
diogopms / Dynupdate
Created May 9, 2016 21:01
Dynupdate
#!/bin/bash
# No-IP uses emails as passwords, so make sure that you encode the @ as %40
USERNAME=username
PASSWORD=password
HOST=hostsite
LOGFILE=logdir/noip.log
STOREDIPFILE=configdir/current_ip
USERAGENT="Simple Bash No-IP Updater/0.4"
@diogopms
diogopms / scrappy.rb
Created October 11, 2016 10:30 — forked from bds/scrappy.rb
Scraping web pages with Ruby for fun and profit
# print the numbers 1 to 5
(1..5).each do |page|
puts page
end
# print a url string with a page number inside
(1..5).each do |page|
puts "http://blog/scripted.com/page/#{page}"
end
@diogopms
diogopms / dummy_data.sh
Created December 21, 2016 17:04
Dummy data shell script
#Create dummy data
DIR=staging/recordings/XXXXXX
FOLDER=dumy_data
mkdir $FOLDER
cd $FOLDER;
mkdir -p $DIR;
for i in {1..100}; do dd if=/dev/urandom bs=1 count=1 of=$DIR/dummy-file$i.mp3; done
@diogopms
diogopms / tmux-cheatsheet.markdown
Created February 11, 2017 14:03 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@diogopms
diogopms / keybase.md
Created February 23, 2017 11:05
keybase.md

Keybase proof

I hereby claim:

  • I am diogopms on github.
  • I am diogopms (https://keybase.io/diogopms) on keybase.
  • I have a public key ASAh5N9Y0ecR14kGGaWqzSQpirO3V_xPotADngLlVszrMwo

To claim this, I am signing this object:

@diogopms
diogopms / issue_wifi_esp32.ino
Created February 15, 2018 10:44
issue_wifi_esp32.ino
#include <Arduino.h>
#include <WiFi.h>
void setup()
{
Serial.begin(9600);
delay(10);
Serial.print("Connecting");