Skip to content

Instantly share code, notes, and snippets.

View danriti's full-sized avatar

Dan Riti danriti

View GitHub Profile
@danriti
danriti / replace.sh
Last active December 28, 2015 19:39
Search and replace text in files
#!/bin/bash
git grep -l replaceMe | xargs sed -i 's/replaceMe/replace.me/g'
@danriti
danriti / json-stub.py
Created November 8, 2013 17:17
Quick JSON Stub in Python
# Useful way to stub an endpoint with JSON contained in a file.
import json
f = open('/path/to/file.json', 'r')
return json.load(f)
@danriti
danriti / hipchat-v2.sh
Last active July 19, 2021 10:49
HipChat API v2 - Send a message to a room using cURL
#!/bin/bash
# Set the ROOM_ID & AUTH_TOKEN variables below.
# Further instructions at https://www.hipchat.com/docs/apiv2/auth
ROOM_ID=XXX
AUTH_TOKEN=XXX
MESSAGE="Hello world!"
curl -H "Content-Type: application/json" \
@danriti
danriti / comments.js
Last active April 30, 2018 20:50
Display all hidden inline comments on a Github issue/pull request. Just copy+pasta into your JS console or make a bookmarklet.
$('.outdated-diff-comment-container').addClass('open');
@danriti
danriti / sync.sh
Created August 30, 2013 00:41
Rsync two directories while ignoring existing files
rsync --ignore-existing --dry-run --verbose -r SOURCE/* DESTINATION

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@danriti
danriti / md2html.sh
Created June 4, 2013 15:19
Convert markdown to HTML
#!/bin/bash
# http://johnmacfarlane.net/pandoc/demos.html
pandoc -s README.md -o README.html
@danriti
danriti / ffmpeg.sh
Last active December 17, 2015 04:29
FFMPEG FOR THE WIN!
# List audio devices
ffmpeg -list_devices true -f dshow -i dummy
# Pipe audio from Line In to another computer (192.168.1.17)
ffmpeg -f dshow -i audio="Line In (High Definition Audio " -acodec libmp3lame -ab 320000 -f rtp rtp://192.168.1.17:1234
# Listen to audio on destination computer
ffplay rtp://192.168.1.17:1234
@danriti
danriti / fdups.py
Last active April 1, 2016 11:53 — forked from miku/fdups.py
# http://stackoverflow.com/questions/748675/finding-duplicate-files-and-removing-them/748908#748908
import sys
import os
import mmh3
CHUNK_SIZE = 1024*1024
def check_for_duplicates(paths):