Skip to content

Instantly share code, notes, and snippets.

View telmofcosta's full-sized avatar

Telmo Costa telmofcosta

View GitHub Profile
@telmofcosta
telmofcosta / keybase.md
Created March 1, 2021 19:29
keybase.md

Keybase proof

I hereby claim:

  • I am telmofcosta on github.
  • I am telmocosta (https://keybase.io/telmocosta) on keybase.
  • I have a public key whose fingerprint is 2384 C6C9 607B A52F 36A2 5377 3836 68C6 3FC3 A250

To claim this, I am signing this object:

@telmofcosta
telmofcosta / backup-restore sdcard
Created February 8, 2015 12:16
Backup and restore an SD card on Mac OS x (perfect for Raspberry Pi)
# insert SD and find out where it is mounted
diskutil list
# /dev/disk0
# #: TYPE NAME SIZE IDENTIFIER
# 0: GUID_partition_scheme *250.1 GB disk0
# ...
# /dev/disk1
# #: TYPE NAME SIZE IDENTIFIER
# 0: FDisk_partition_scheme *15.7 GB disk1
# ...
@telmofcosta
telmofcosta / killport
Created November 30, 2012 11:22
kill process running on some port
#!/bin/bash
PORT=$1
if [ -n "$PORT" ]; then
LINE=$(lsof -i tcp -n -P | grep ":$PORT (LISTEN)")
if [ -n "$LINE" ]; then
echo $LINE
PID=$(echo $LINE | awk '{print $2}')
fi
if [ -n "$PID" ]; then
echo "kill -9 $PID"