Skip to content

Instantly share code, notes, and snippets.

@erikson1970
erikson1970 / backup_digitalocean.md
Last active April 1, 2023 14:56 — forked from amalmurali47/backup_digitalocean.md
Backup DigitalOcean droplet locally

DigitalOcean does not provide a way to download a snapshot of your droplet locally. You can use rsync to accomplish this instead.

On your local machine, assuming you have added your-server in your SSH config:

rsync -aAXHv --append-verify --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} your-server:/
  • -a : archive mode (all files, with permissions, etc.)
  • -A : preserve ACLs/permissions (not included with -a)
@erikson1970
erikson1970 / SpawniTerm.applescript
Created July 22, 2022 19:37 — forked from keith/SpawniTerm.applescript
Spawn a new iTerm window in the pwd
on run argv
tell application "iTerm"
set t to make new terminal
tell t
activate current session
launch session "Default Session"
tell the last session
write text "cd \"" & item 1 of argv & "\"; clear; pwd"
end tell
end tell
@erikson1970
erikson1970 / gnuradio-m1-macs.md
Created February 24, 2022 20:18 — forked from daniestevez/gnuradio-m1-macs.md
GNU Radio in M1 Macs (with Docker Desktop)

GNU Radio in M1 Macs (with Docker Desktop)

This note describes the steps we took with the SETI Institute summer interns 2021 to install GNU Radio in their M1 Macs (MacBook Air M1 2020 model). We used gnuradio-docker-env as a starting point, which was of invaluable help.

There might be omissions, typos, etc., in this note, so any feedback is welcome. The procedure could also be streamlined a lot by generating known-good images and pushing the to Docker Hub.

XQuartz

To create a new Device ID (and reset configuration) after cloning a VM with Syncthing, just remove the content of this folder:
- Unix-like: $HOME/.config/syncthing
- Mac: $HOME/Library/Application Support/Syncthing
- Windows XP: %AppData%/Syncthing
- Windows 7+: %LocalAppData%/Syncthing
@erikson1970
erikson1970 / tmux-cheatsheet.markdown
Created December 29, 2021 15:21 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@erikson1970
erikson1970 / m3u8-to-mp4.md
Created February 16, 2021 14:52 — forked from tzmartin/m3u8-to-mp4.md
m3u8 stream to mp4 using ffmpeg

1. Copy m3u8 link

Alt text

2. Run command

echo "Enter m3u8 link:";read link;echo "Enter output filename:";read filename;ffmpeg -i "$link" -bsf:a aac_adtstoasc -vcodec copy -c copy -crf 50 $filename.mp4
@erikson1970
erikson1970 / vpn.md
Created December 22, 2020 20:32 — forked from joepie91/vpn.md
Don't use VPN services.

Don't use VPN services.

No, seriously, don't. You're probably reading this because you've asked what VPN service to use, and this is the answer.

Note: The content in this post does not apply to using VPN for their intended purpose; that is, as a virtual private (internal) network. It only applies to using it as a glorified proxy, which is what every third-party "VPN provider" does.

  • A Russian translation of this article can be found here, contributed by Timur Demin.
  • A Turkish translation can be found here, contributed by agyild.
  • There's also this article about VPN services, which is honestly better written (and has more cat pictures!) than my article.
@erikson1970
erikson1970 / ffmpeg_mkv_mp4_conversion.md
Created December 22, 2020 02:29 — forked from jamesmacwhite/ffmpeg_mkv_mp4_conversion.md
Easy way to convert MKV to MP4 with ffmpeg

Converting mkv to mp4 with ffmpeg

Essentially just copy the existing video and audio stream as is into a new container, no funny business!

The easiest way to "convert" MKV to MP4, is to copy the existing video and audio streams and place them into a new container. This avoids any encoding task and hence no quality will be lost, it is also a fairly quick process and requires very little CPU power. The main factor is disk read/write speed.

With ffmpeg this can be achieved with -c copy. Older examples may use -vcodec copy -acodec copy which does the same thing.

These examples assume ffmpeg is in your PATH. If not just substitute with the full path to your ffmpeg binary.

Single file conversion example

@erikson1970
erikson1970 / IOTstackPullRequest.md
Created December 11, 2020 14:07 — forked from Paraphraser/IOTstackPullRequest.md
Preparing IOTstack Pull Requests

Preparing a Pull Request for IOTstack

If you want to fix a bug or propose an enhancement for IOTstack, you will need to prepare a Pull Request (PR).

Please don't try to do anything in this gist inside an ~/IOTstack folder on a Raspberry Pi that is also being used to run your Docker containers. It's easy to get confused and you could accidentally break your own working IOTstack.

You can do everything on the same Raspberry Pi that is running your IOTstack but it's usually easier to work on a desktop or laptop. If you accept this advice, there's no risk of breaking your running IOTstack.

This guide barely scratches the surface of Pull Requests. There is lots of advice on GitHub and Google will find plenty of hits for any question you might have.

@erikson1970
erikson1970 / select_input.py
Last active October 8, 2018 21:12 — forked from atupal/select_input.py
Keyboard input with timeout in Python
import sys, select
print "You have ten seconds to answer!"
i, o, e = select.select( [sys.stdin], [], [], 10 )
if (i):
print "You said", sys.stdin.readline().strip()
else:
print "You said nothing!"