This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| NUM_COLORS = 22 | |
| cm = get_cmap('gist_rainbow') | |
| for i in range(NUM_COLORS): | |
| color = cm(1.*i/NUM_COLORS) # color will now be an RGBA tuple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| infinite_defaultdict = lambda: defaultdict(infinite_defaultdict) | |
| d = infinite_defaultdict() | |
| d['x']['y']['z'] = 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def tuftestyle(ax): | |
| """Styles an axes object to have minimalist graph features""" | |
| ax.grid(True, 'major', color='w', linestyle='-', linewidth=1.5,alpha=0.6) | |
| ax.patch.set_facecolor('white') | |
| #ax.set_axisbelow(True) | |
| ax.spines["right"].set_visible(False) | |
| ax.spines["top"].set_visible(False) | |
| ax.spines["bottom"].set_visible(False) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def drawBars(ax, s, ypos, xpos = [0.5,1.5], tick_height = 0.02, fontsize=12, fontcolor="black"): | |
| ypos = ypos/float(ax.get_ylim()[1]) + tick_height | |
| trans = transforms.blended_transform_factory(ax.transData, ax.transAxes) | |
| l = Line2D([xpos[0], xpos[0], xpos[1], xpos[1]],[ypos, ypos+tick_height, ypos+tick_height, ypos], lw=1.5, c="k", transform=trans) | |
| ax.text(xpos[0] + ((xpos[1]-xpos[0])/2.), ypos + (tick_height*1.5), s=s, ha= "center", va="bottom", fontsize=fontsize, color=fontcolor, transform=trans) | |
| ax.add_line(l) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def autolabel(ax,rects,text,fmt=None,below=False,offset_fraction=0.05): | |
| for rect,t in zip(rects,text): | |
| height = rect.get_height()+rect.get_y() | |
| if below: | |
| ax.text(rect.get_x()+rect.get_width()/2., (1-offset_fraction)*height, t, | |
| ha='center', va='top', **fmt) | |
| else: | |
| ax.text(rect.get_x()+rect.get_width()/2., (1+offset_fraction)*height, t, | |
| ha='center', va='bottom', **fmt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Improve the log (https://coderwall.com/p/euwpig?i=3&p=1&t=git) | |
| git config --global alias.lg "log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --" | |
| Enable color in git: | |
| git config --global --add color.ui true | |
| Make git push only push the current branch | |
| git config --global push.default current |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pd.concat(g for _, g in df.groupby("duplicated_key_name") if len(g) > 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Reset | |
| Color_Off="\[\033[0m\]" # Text Reset | |
| # Regular Colors | |
| Black="\[\033[0;30m\]" # Black | |
| Red="\[\033[0;31m\]" # Red | |
| Green="\[\033[0;32m\]" # Green | |
| Yellow="\[\033[0;33m\]" # Yellow | |
| Blue="\[\033[0;34m\]" # Blue | |
| Purple="\[\033[0;35m\]" # Purple |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| {% macro simple_table(data, rowlink_prefix, column_order, column_names, id_field="_id") %} | |
| <table class="table table-hover table-condensed" data-provides="rowlink"> | |
| {{ table_header(column_names|default(column_order|default(data[0])))}} | |
| <tbody> | |
| {% for row in data %} | |
| <tr> | |
| {% for item in column_order|default(row) %} | |
| {% if (rowlink_prefix != None) and (item == id_field) %} | |
| <td><a href='{{ rowlink_prefix + row[item] | string }}'>{{ row[item] }}</a></td> |
OlderNewer