Skip to content

Instantly share code, notes, and snippets.

View radovankavicky's full-sized avatar
🐍
Pythonista

Radovan Kavicky radovankavicky

🐍
Pythonista
View GitHub Profile
@jurandysoares
jurandysoares / christmastree.py
Created December 26, 2012 15:04
A small Christmas' Tree Algorithm in Python.
import turtle
screen = turtle.Screen()
screen.setup(800,600)
circle = turtle.Turtle()
circle.shape('circle')
circle.color('red')
circle.speed('fastest')
circle.up()
@alexpeattie
alexpeattie / disable-autolinking.md
Created February 7, 2013 07:32
Disable Github-flavored Markdown autolinking

http://example.com

http://example.com

@geotheory
geotheory / ggplot_hex.R
Last active January 28, 2021 17:16
ggplot2 functionality for mapping to hexagon size and colour aesthetics
#' GGPLOT2 FUNCTIONALITY FOR MAPPING TO HEXAGON SIZE AND COLOUR AESTHETICS
#' by Robin Edwards, 2013 (geotheory.co.uk, @geotheory)
#' This has been adapted from the ggplot bin_hex.R script that underpins geom_hex, etc
#' (see https://github.com/hadley/densityvis/blob/master/R/bin-hex.r).
#'
#' These functions implement aesthetic mapping to hexagon size (area), in addition to the existing
#' colour-mapping functionality. The key change is the addition of a new fourth variable (var4)
#' to hex_bin(), which complements the inbuilt hexagon binning functionality. The 'frequency.to.area'
#' argument enables the default mappings of binned data to colour and var4 to size to be interchanged.
#' The hmin/hmax arguments [0,1] set area mapping constraints (hmax can exceed 1).
@rbrath
rbrath / LandGrid.js
Last active May 7, 2024 17:57
Equal Size Cartogram
var landGrid = [
{
"X": "1",
"Y": "1"
},
{
"X": "1",
"Y": "2"
},
{
@bsweger
bsweger / useful_pandas_snippets.md
Last active April 19, 2024 18:04
Useful Pandas Snippets

Useful Pandas Snippets

A personal diary of DataFrame munging over the years.

Data Types and Conversion

Convert Series datatype to numeric (will error if column has non-numeric values)
(h/t @makmanalp)

@jish
jish / github.com.js
Created October 10, 2014 23:00
Octocats for empty notifications
$(document).ready(function(){
if (document.location.pathname.match(/\/notifications$/)) {
var array = [
"adventure-cat",
"agendacat",
"andycat",
"baracktocat",
"bear-cavalry",
@LeiG
LeiG / python-RData.py
Last active April 8, 2022 14:06
Python and .RData files
import rpy2.robjects as robjects
import pandas.rpy.common as com
import pandas as pd
## load .RData and converts to pd.DataFrame
robj = robjects.r.load('test.RData')
# iterate over datasets the file
for sets in robj:
myRData = com.load_data(sets)
# convert to DataFrame
@roachhd
roachhd / README.md
Last active July 25, 2024 12:36
EMOJI cheatsheet 😛😳😗😓🙉😸🙈🙊😽💀💢💥✨💏👫👄👃👀👛👛🗼🔮🔮🎄🎅👻

EMOJI CHEAT SHEET

Emoji emoticons listed on this page are supported on Campfire, GitHub, Basecamp, Redbooth, Trac, Flowdock, Sprint.ly, Kandan, Textbox.io, Kippt, Redmine, JabbR, Trello, Hall, plug.dj, Qiita, Zendesk, Ruby China, Grove, Idobata, NodeBB Forums, Slack, Streamup, OrganisedMinds, Hackpad, Cryptbin, Kato, Reportedly, Cheerful Ghost, IRCCloud, Dashcube, MyVideoGameList, Subrosa, Sococo, Quip, And Bang, Bonusly, Discourse, Ello, and Twemoji Awesome. However some of the emoji codes are not super easy to remember, so here is a little cheat sheet. ✈ Got flash enabled? Click the emoji code and it will be copied to your clipboard.

People

:bowtie: 😄

@hrbrmstr
hrbrmstr / ggplotrbokeh.R
Created May 26, 2015 21:57
ggplot <-> rbokeh
library(ggplot2)
library(rbokeh)
library(htmlwidgets)
structure(list(wk = structure(c(16069, 16237, 16244, 16251, 16279,
16286, 16300, 16307, 16314, 16321, 16328, 16335, 16342, 16349,
16356, 16363, 16377, 16384, 16391, 16398, 16412, 16419, 16426,
16440, 16447, 16454, 16468, 16475, 16496, 16503, 16510, 16517,
16524, 16538, 16552, 16559, 16566, 16573), class = "Date"), n = c(1L,
1L, 1L, 1L, 3L, 1L, 3L, 2L, 4L, 2L, 3L, 2L, 5L, 5L, 1L, 1L, 3L,
@jbwhit
jbwhit / post-save-hook.py
Last active September 21, 2023 04:50
Saves Jupyter Notebooks as .py and .html files automatically. Add to the ipython_notebook_config.py file of your associated profile.
import os
from subprocess import check_call
def post_save(model, os_path, contents_manager):
"""post-save hook for converting notebooks to .py and .html files."""
if model['type'] != 'notebook':
return # only do this for notebooks
d, fname = os.path.split(os_path)
check_call(['jupyter', 'nbconvert', '--to', 'script', fname], cwd=d)
check_call(['jupyter', 'nbconvert', '--to', 'html', fname], cwd=d)