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 / 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 / README.md
Last active Apr 18, 2019
Line Profiling in Python
View README.md

Install the line_profiler module:

[driti@ubuntu ]$ pip install line_profiler

Add the @profile decorator and run:

[driti@ubuntu ]$ kernprof.py -l -v example.py
@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 / gist:2869387
Created Jun 4, 2012
Generate user activation key for a Django user
View gist:2869387
"""
The activation key for the ``UserProfile`` will be a
SHA1 hash, generated from a combination of the ``User``'s
email and a random salt.
"""
salt = hashlib.sha1(str(random.random())).hexdigest()[:5]
email = user.email
if isinstance(email, unicode):
@danriti
danriti / hipchat.sh
Last active Feb 22, 2017
HipChat - Send a message to a room using cURL
View hipchat.sh
# Build Passes
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Passing&color=green" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
# Build Fails
curl -d "room_id=ourRoom&from=BuildBot&message=Build+Status:+Failing&color=red&notify=1" https://api.hipchat.com/v1/rooms/message?auth_token=AUTH_TOKEN_HERE&format=json
View keybase.md

Keybase proof

I hereby claim:

  • I am danriti on github.
  • I am danriti (https://keybase.io/danriti) on keybase.
  • I have a public key whose fingerprint is 9194 075E F796 62A4 B932 F80D 8334 5A61 B4F5 74A2

To claim this, I am signing this object:

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):
@danriti
danriti / vector.md
Last active Mar 9, 2016
pcp + vector + filtered per process stats
View vector.md

run on ubuntu 12.04

  1. install pcp from source following: https://github.com/Netflix/vector/wiki/Installing-Performance-Co-Pilot
  2. install vector following: https://github.com/Netflix/vector/wiki/Getting-Started#vector
  3. update pmwedb config to use port 9999 by default: /etc/pcp/pmwebd/pmwebd.options
  4. sudo service pmwebd restart
  5. update pmcd to run proc pmda as root (add -A flag): /etc/pcp/pmcd/pmcd.conf
  6. sudo service pcp restart
  7. run vector via gulp: https://github.com/Netflix/vector/wiki/Getting-Started#running-with-gulp
  8. created a hotproc.conf in /var/lib/pcp/pmdas/proc
@danriti
danriti / pypi.md
Last active Jan 18, 2016
pypi release notes / checklist
View pypi.md

Basic Instruction Before Releasing to PyPI

  1. Update history

  2. Increment version

  3. Run tox tests for Python 2.7, 3.2, 3.3, 3.4, 3.5:

    PATH=~/opt/bin 
    export TV_API_KEY=XXX
    export TV_APP_NAME=XXX
    
@danriti
danriti / pickaxe.sh
Created Dec 13, 2013
Search git log for a specific code change.
View pickaxe.sh
git log -S"validate=True" -- boto/s3/connection.py
You can’t perform that action at this time.