Skip to content

Instantly share code, notes, and snippets.

View tonyelhabr's full-sized avatar
🏠
Working from home

Tony ElHabr tonyelhabr

🏠
Working from home
View GitHub Profile
@rxaviers
rxaviers / gist:7360908
Last active July 26, 2024 03:07
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@kevin-smets
kevin-smets / iterm2-solarized.md
Last active July 23, 2024 04:22
iTerm2 + Oh My Zsh + Solarized color scheme + Source Code Pro Powerline + Font Awesome + [Powerlevel10k] - (macOS)

Default

Default

Powerlevel10k

Powerlevel10k

@conormm
conormm / r-to-python-data-wrangling-basics.md
Last active July 23, 2024 17:45
R to Python: Data wrangling with dplyr and pandas

R to python data wrangling snippets

The dplyr package in R makes data wrangling significantly easier. The beauty of dplyr is that, by design, the options available are limited. Specifically, a set of key verbs form the core of the package. Using these verbs you can solve a wide range of data problems effectively in a shorter timeframe. Whilse transitioning to Python I have greatly missed the ease with which I can think through and solve problems using dplyr in R. The purpose of this document is to demonstrate how to execute the key dplyr verbs when manipulating data using Python (with the pandas package).

dplyr is organised around six key verbs:

@jonocarroll
jonocarroll / images_as_xaxis_labels_updated.R
Last active September 7, 2021 05:43
Implements @baptiste's much better method for making this work
library(ggplot2) ## devtools::install_github("hadley/ggplot2)
library(grid) ## rasterGrob
library(EBImage) ## readImage (alternatively: magick::image_read)
library(ggthemes) ## theme_minimal
## ##########
## INDEPENDENT CODE TO BE SOURCED:
## ##########
# user-level interface to the element grob
@johnmackintosh
johnmackintosh / Calendarplot.R
Last active October 30, 2018 05:00
calendar plots in R
library(ggplot2)
library(lubridate)
library(tidyr)
library(viridis)
#library(extrafont) # optional
library(lubridate)
library(gridExtra)
library(ggExtra)
library(dplyr)
@0x4D31
0x4D31 / beautiful_idiomatic_python.md
Last active July 8, 2024 09:36 — forked from JeffPaine/beautiful_idiomatic_python.md
[Beautiful Idiomatic Python] Transforming Code into Beautiful, Idiomatic Python #python

Transforming Code into Beautiful, Idiomatic Python

Notes from Raymond Hettinger's talk at pycon US 2013 video, slides.

The code examples and direct quotes are all from Raymond's talk. I've reproduced them here for my own edification and the hopes that others will find them as handy as I have!

Looping over a range of numbers

for i in [0, 1, 2, 3, 4, 5]:
#!/bin/bash
TODAY=`date +%Y-%m-%d`
TODAY_MD=`date +%B\ %d,\ %Y`
YEAR=`date +%Y`
PACKAGENAME=$1
##
## CHANGE ME!!!
library(furrr)
# localhost -> AWS EC2 linux -> Docker running on that -> R
# dm_create() and dm_ip() are from an unreleased R pkg I whipped up, dockermachinery
# https://github.com/DavisVaughan/dockermachinery
# Creates 1 t2.micro EC2 instance
dm_create("amazonec2", "dockertest")
@nvictus
nvictus / cool.r
Last active August 27, 2021 15:59
coolR: a cooler reader for R
# Notes
# -----
# * Cooler's stored bin IDs are 0-based. However, for consistency with R, this API should take
# 1-based indexing as input for table row and matrix range queries.
# * See Ilya's implementation: https://github.com/dozmorovlab/HiCcompare/issues/9
library(hdf5r)
library(dplyr)
library(tibble)
library(purrr)
library(data.table)
library(tidyverse)

# See https://stackoverflow.com/a/17313561/120898
pts <- function(x) {
  as.numeric(grid::convertUnit(grid::unit(x, "pt"), "mm"))
}

df <- tibble(x = 1:10, y = 1:10)