Skip to content

Instantly share code, notes, and snippets.

Dan Riti danriti

Block or report user

Report or block danriti

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@danriti
danriti / replace.sh
Last active Dec 28, 2015
Search and replace text in files
View replace.sh
#!/bin/bash
git grep -l replaceMe | xargs sed -i 's/replaceMe/replace.me/g'
@danriti
danriti / json-stub.py
Created Nov 8, 2013
Quick JSON Stub in Python
View json-stub.py
# 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 Jul 31, 2019
HipChat API v2 - Send a message to a room using cURL
View hipchat-v2.sh
#!/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 Apr 30, 2018
Display all hidden inline comments on a Github issue/pull request. Just copy+pasta into your JS console or make a bookmarklet.
View comments.js
$('.outdated-diff-comment-container').addClass('open');
@danriti
danriti / sync.sh
Created Aug 30, 2013
Rsync two directories while ignoring existing files
View sync.sh
rsync --ignore-existing --dry-run --verbose -r SOURCE/* DESTINATION
View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@danriti
danriti / md2html.sh
Created Jun 4, 2013
Convert markdown to HTML
View md2html.sh
#!/bin/bash
# http://johnmacfarlane.net/pandoc/demos.html
pandoc -s README.md -o README.html
@danriti
danriti / ffmpeg.sh
Last active Dec 17, 2015
FFMPEG FOR THE WIN!
View ffmpeg.sh
# 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
View 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):
You can’t perform that action at this time.