Skip to content

Instantly share code, notes, and snippets.

View ravipudi's full-sized avatar

Murali Ravipudi ravipudi

  • Wells Fargo India
  • Hyderabad
  • 13:46 (UTC +05:30)
View GitHub Profile
@jeffreycrow
jeffreycrow / googleMapsPolylineMidpoint.js
Last active August 17, 2019 07:12
Function for the Google Maps API V3 that returns a LatLng object representing the midpoint of a complex polyline (taken in as an array of points). Also requires midpoint distance, but this is easily calculable from the array of points.
getMidpoint: function(points, midpointDistance) {
var tempDistance = midpointDistance;
var midpointLatLng;
// We go through each segment of the line
for (var i = 0; i < points.length - 1; i++) {
var segment = points.slice(i, i + 2);
var length = google.maps.geometry.spherical.computeLength(segment);
tempDistance = tempDistance - length;
@emiller
emiller / git-mv-with-history
Last active July 24, 2025 22:22
git utility to move/rename file or folder and retain history with it.
#!/bin/bash
#
# git-mv-with-history -- move/rename file or folder, with history.
#
# Moving a file in git doesn't track history, so the purpose of this
# utility is best explained from the kernel wiki:
#
# Git has a rename command git mv, but that is just for convenience.
# The effect is indistinguishable from removing the file and adding another
# with different name and the same content.
@jlfwong
jlfwong / RequireJSsubprocess.md
Created September 29, 2013 19:24
Require JS Subprocess Rubber Ducky Log

Building the package! RequireJS plugin, I'm getting weird side effect problems.

Requiring a package first:

> require(["package!issues.js"]); null
null
Require Package: issues.js package_loader_plugin.js?bust=1379092758956:96
XHR finished loading: "http://localhost:1234/javascript-packages.json".

jquery.js?bust=1379092758956:8526

@jbenet
jbenet / simple-git-branching-model.md
Last active July 21, 2025 21:02
a simple git branching model

a simple git branching model (written in 2013)

This is a very simple git workflow. It (and variants) is in use by many people. I settled on it after using it very effectively at Athena. GitHub does something similar; Zach Holman mentioned it in this talk.

Update: Woah, thanks for all the attention. Didn't expect this simple rant to get popular.

@ionelmc
ionelmc / profiled_decorator.py
Last active February 19, 2017 09:49
Profiling decorator that generates kcachegrind output.
import cProfile
import os
import pstats
import time
from datetime import datetime
from functools import wraps
from io import StringIO
from logging import getLogger
logger = getLogger(__name__)
@kanzure
kanzure / git-commit-cleaner.py
Last active May 17, 2022 17:25
git-filter-branch examples and notes
"""
Creates pretty-looking commit messages for git. This was created to pretty
print the old-commit-id values for filter-branched-rewritten commits in
pyphantomjs from the phantomjs repository.
"""
import os
import sys
class Node(object):
"""
Tree node: left and right child + data which can be any object
"""
def __init__(self, data):
"""
Node Constructor
@param data node data object
"""
self.left = None
@akaptur
akaptur / gist:4348873
Last active December 10, 2015 00:09
A small depiction of issues with floating point arithmetic in python.
def naive_add(lis):
total = 0
for elem in lis:
total += elem
return total
def recursive_add(lis):
if len(lis) == 1:
return lis[0]
elif len(lis) == 0:
@anupamsharma
anupamsharma / EclipsingBinaryStarClassRep.py
Last active October 11, 2015 10:48
AstronomicalObjectsClassRep
# Initial eclipsing binary star intro
# http://www.physics.sfasu.edu/astro/ebstar/ebstar.html
#
class LightCurve(object):
"""
This class represents light curve of an astronomical object. Light curve means
curve between time and magnitude (visual magnitude in this case).
"""
def __init__(self, start_date, time_unit):
self._points = []
@nicwolff
nicwolff / gist:2925803
Created June 13, 2012 19:00
'tcsh' Git prompt to show current branch
# in ~/bin/gitprompt.csh:
setenv GIT_BRANCH_CMD "sh -c 'git branch --no-color 2> /dev/null' | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1) /'"
set prompt="%m:%~ `$GIT_BRANCH_CMD`%B%#%b "
# and then in ~/.cshrc:
alias precmd "source ~/bin/gitprompt.csh"