Skip to content

Instantly share code, notes, and snippets.

@scottopell
scottopell / fix_exfat_drive.md
Last active April 30, 2024 22:46
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@scottopell
scottopell / port_forward_dg2470A.md
Last active January 18, 2024 20:19
How to forward a port on Arris DG2470A

Port forwarding should be fairly straightforward, but what Arris doesn't tell you is that you need to have the firewall on in order for port forwarding settings to have an effect.

I don't know why the "firewall off" option would mean "block everything", but as best I can tell, that was the case on my Arris DG2470A (from RCN, could be some custom firmware that RCN uses?)

So step by step:

@scottopell
scottopell / zpty.md
Last active November 27, 2023 12:50
zpty

zpty

Zsh has a feature called zpty which creates a pseudo-terminal in the background.

According to the docs, this can be useful to run a program in the background that expects to be run in a normal terminal environment.

Some zsh themes such as pure use this to run commands asynchronously. Pure uses the zsh plugin zsh-async for this.

@scottopell
scottopell / remove_audio_track.md
Last active September 19, 2023 19:29
How to remove an audio track from an mkv
  1. Install mkvtoolsnix.
  2. brew install --with-qt5 mkvtoolnix
  3. Use mkvinfo to get the audio track IDs that you want.
  4. mkvinfo *.mkv
  5. Note that the audio track IDs are not the track numbers. Check the man page of mkvmerge or mkvinfo for more details.
  6. Use mkvmerge to create a copy of the mkv with ONLY the desired tracks using --audio-tracks.
  7. mkvmerge -o out.mkv -a 2 orig.mkv
We couldn’t find that file to show.
@scottopell
scottopell / sh.sh
Created September 8, 2016 15:40
Embed SRT file into mp4 with ffmpeg
# got this from http://stackoverflow.com/questions/8672809/use-ffmpeg-to-add-text-subtitles
ffmpeg -i infile.mp4 -f srt -i infile.srt -c:v copy -c:a copy -c:s mov_text outfile.mp4
# confirmed working with the following ffmpeg
# (installed using `brew 'ffmpeg', args: ['with-libvorbis', 'with-libvpx']` )
ffmpeg version 3.1.2 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.3.0 (clang-703.0.31)
configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libvorbis --enable-libvpx --disable-lzma --enable-vda
@scottopell
scottopell / simpleget.go
Last active September 1, 2022 15:50
Where does Go get its trusted CAs from?
package main
import (
"crypto/tls"
"fmt"
)
// go build && strace -o strace-out.txt -f -e trace=file ./simpleget
func main() {
conn, err := tls.Dial("tcp", "www.google.com:443", nil)
@scottopell
scottopell / serversetup.md
Last active April 18, 2020 16:28
Just random shit that I always have to look up when I'm setting up a server
@scottopell
scottopell / setup_hc2.markdown
Last active February 24, 2020 08:03
Setup torrent + media server on Orange Pi HC2

Orange pi HC2 setup

This is my 3rd iteration of this guide, and now it appears that armbian officially supports the orange pi pc2!

Goals

  • rtorrent
  • plex
  • flood (or similar rtorrent web interface)
  • support external usb3 hd with exfat
@scottopell
scottopell / get_all_bitbucket.sh
Created August 25, 2016 21:54
Clone all user's repos on bitbucket
#!/bin/bash
# Script to clone all repositories under a user from bitbucket
# Usage: getAllRepos.sh [username]
repos=$(curl -u ${1} https://api.bitbucket.org/1.0/users/${1} | jq -r '.repositories[] | .slug')
vcs=git # or hg
for repo_name in $repos
do
echo -e "\tFetching $repo_name"
$vcs clone "ssh://$vcs@bitbucket.org/${1}/$repo_name"