Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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
@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 / 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"
@scottopell
scottopell / gist:5038ed75213755fcc49fe949366c6c23
Created August 12, 2016 14:50
Bind local port to remote port with plain SSH (basically ngrok)
# generic version
ssh -R <remote_port>:<local_interface>:<local_port> <remote machine>
# example (dev is a host configured in ~/.ssh/config)
ssh -R 4567:localhost:4567 dev
# Ubuntu hosts require an extra step of config
# http://askubuntu.com/questions/50064/reverse-port-tunnelling/50075#50075
# (run on server)
sudo echo -e "Match User scott\n GatewayPorts yes" >> /etc/ssh/sshd_config
@scottopell
scottopell / create_hound_config.sh
Last active August 5, 2016 16:25
Creates a hound (etsy/hound) configuration file that will index a given users public github repos.
#!/bin/sh
user=scottopell
json=$(curl -s https://api.github.com/users/$user/repos\?type\=owner\&per_page\=300 | jq 'reduce .[] as $pair ( {}; . + { ($pair.name): { url: $pair.html_url } } )')
echo "\
{
\"max-concurrent-indexers\": 2,
\"dbpath\": \"data\",
\"repos\": $json
}"

Keybase proof

I hereby claim:

  • I am scottopell on github.
  • I am scott_o (https://keybase.io/scott_o) on keybase.
  • I have a public key whose fingerprint is 91BE AEDD 380A FB1E 0616 0057 16BF E230 853D 68F5

To claim this, I am signing this object:

import java.io.*;
import java.util.*;
public class Solution {
static boolean isAnagram(String A, String B) {
//Complete the function
if (A.length() != B.length())
return false;
#include <stdio.h>
int main(){
int i = 0;
int a = 3;
int b = 5;
{
int c = 7;
printf(" c: %d\n", c);
printf("&c: %u\n", &c);
}