Skip to content

Instantly share code, notes, and snippets.

View cx0's full-sized avatar
🙊

Onuralp cx0

🙊
View GitHub Profile
@masih
masih / fish_shell_local_install.sh
Last active June 1, 2024 22:23
Installs Fish Shell without root access
#!/bin/bash
# Script for installing Fish Shell on systems without root access.
# Fish Shell will be installed in $HOME/local/bin.
# It's assumed that wget and a C/C++ compiler are installed.
# exit on error
set -e
FISH_SHELL_VERSION=2.1.1
@cmaureir
cmaureir / sge_status.md
Last active October 5, 2023 17:22
Sun Grid Engine SGE state letter symbol codes meanings
@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)

@stephenturner
stephenturner / deseq2-analysis-template.R
Created July 30, 2014 12:20
Template for analysis with DESeq2
## RNA-seq analysis with DESeq2
## Stephen Turner, @genetics_blog
# RNA-seq data from GSE52202
# http://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=gse52202. All patients with
# ALS, 4 with C9 expansion ("exp"), 4 controls without expansion ("ctl")
# Import & pre-process ----------------------------------------------------
# Import data from featureCounts
@obenshaindw
obenshaindw / Stream VCF from S3
Last active April 6, 2023 09:45
Stream VCF file from AWS s3 and do stuff (sort, gzip, index, subset for specific region)
#!/usr/bin/bash
#
# make_gz.sh
#
# Call this script with a list of s3 locations with VCF files to parse
# aws --profile NDAR s3 ls s3:/S3_URL/ | awk '{print $4}' | xargs -n1 -P4 sh make_gz.sh
# xargs -n1 -P4 accepts one argument and runs 4 parallel processes
#
@jfpuget
jfpuget / Julia_Python_perf.ipynb
Last active April 15, 2022 11:55
An exercise in Python optimization: make Python benchmarks as fast, if not faster, than Julia.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@john-science
john-science / gzip_files_in_python.md
Last active May 27, 2021 16:47
Reading & Writing GZIP Files Faster in Python

Reading & Writing GZIP Files in Python

I have been testing various ways to read and write text files with GZIP in Python. There were a lot of uninteresting results, but there were two I thought were worth sharing.

Writing GZIP files

If you have a big list of strings to write to a file, you might be tempted to do:

f = gzip.open(out_path, 'wb')

for line in lines:

@JimGrange
JimGrange / effect_sizes.R
Last active November 25, 2021 15:48
Low power = inaccurate effect size estimates
#------------------------------------------------------------------------------
rm(list = ls())
set.seed(50)
# function for generating random draws from multivariate distribution
# n = number of draws; p = number of variables
# u = mean of each variable; s = SD of each variable
# corMat = correlation matrix
mvrnorm <- function(n, p, u, s, corMat) {
@rasmusab
rasmusab / the-probability-my-son-will-be-stung-by-a-bumblebee.R
Created August 14, 2017 12:17
R and Stan script calculating the probability that my son will be stung by a bumblebee.
library(tidyverse)
library(purrr)
library(rstan)
### Defining the data ###
#########################
bumblebees <- c(1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1,
0, 0, 1, 0, 0, 0, 0, 0, 0)
toddler_steps <- c(26, 16, 37, 101, 12, 122, 90, 55, 56, 39, 55, 15, 45, 8)
@johnmyleswhite
johnmyleswhite / deans_example.R
Created October 7, 2017 12:04
Ratios in causal inference
library("ggplot2")
library("dplyr")
# Population size
n <- 2500
# Sessions per user if assigned to test
sessions_test <- as.integer(exp(rnorm(n, 0.5, 1)))
# Sessions per user if assigned to control