Skip to content

Instantly share code, notes, and snippets.

@MarvinT
MarvinT / black_code_prettify.json
Last active January 16, 2023 15:41
json you can paste into jupyter notebook's code prettify configuration that makes it use black to reformat your code instead of yapf.
{
"python": {
"library": "import json\ndef black_reformat(cell_text):\n import black\n import re\n cell_text = re.sub('^%', '#%#', cell_text, flags=re.M)\n try:\n reformated_text = black.format_str(cell_text, 88)\n except TypeError:\n reformated_text = black.format_str(cell_text, mode=black.FileMode(line_length=88))\n return re.sub('^#%#', '%', reformated_text, flags=re.M)",
"prefix": "print(json.dumps(black_reformat(u",
"postfix": ")))"
},
"r": {
"library": "library(formatR)\nlibrary(jsonlite)",
"prefix": "cat(toJSON(paste(tidy_source(text=",
"postfix": ", output=FALSE)[['text.tidy']], collapse='\n')))"
@ganapativs
ganapativs / iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup.md
Last active April 26, 2024 02:55
iTerm2 + oh-my-zsh + Pure theme + zsh plugins setup
@namoshizun
namoshizun / regret_matching.py
Created July 14, 2017 01:03
Use regret matching to play rock-paper-scissors
from __future__ import division
from random import random
import numpy as np
import pandas as pd
'''
Use regret-matching algorithm to play Scissors-Rock-Paper.
'''
class RPS:
@5agado
5agado / Pandas and Seaborn.ipynb
Created February 20, 2017 13:33
Data Manipulation and Visualization with Pandas and Seaborn — A Practical Introduction
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cavedave
cavedave / README.md
Last active January 3, 2022 20:40
When will the Carnage end?

"This American carnage stops right here and stops right now." Donald Trump

Draw for yourself the pattern of how many people are murdered in the US each year

This code was made by Adam Pearce and the data comes from Homicide Trends in United States

@dmargala
dmargala / NeighboringDataScientists.ipynb
Last active August 17, 2016 23:29
How clustered are data scientists in the office?
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@fredbenenson
fredbenenson / kickstarter_sql_style_guide.md
Last active April 2, 2024 15:19
Kickstarter SQL Style Guide
layout title description tags
default
SQL Style Guide
A guide to writing clean, clear, and consistent SQL.
data
process

Purpose

@marcelinollano
marcelinollano / anki.rb
Last active August 26, 2020 11:16
You can use Markdown inside the questions and answers! Images in the same folder though.
#!/usr/bin/env ruby
# Usage:
#
# => brew install imagemagick
# => gem install anki2 kramdown rmagick image_optim image_optim_pack
# => chmod +x ./anki.rb
# => ./anki.rb questions.md
require 'rubygems'
@AustinRochford
AustinRochford / Bayesian Survival analysis with PyMC3.ipynb
Last active April 10, 2022 05:02
Bayesian Survival analysis with PyMC3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/bin/bash
# Usage:
# sudo su
# export https_proxy=proxy:8888
# wget https://gist.githubusercontent.com/danielballan/c02c17f92650e21488a3/raw -O setup_conda.sh
# chmod +x setup_conda.sh
# rm -rf ~/.conda
# rm ~/.condarc
# ./setup_conda.sh