Skip to content

Instantly share code, notes, and snippets.

View numpde's full-sized avatar

numpde

View GitHub Profile
@numpde
numpde / affy_in_python
Last active September 14, 2020 04:35
How to process a CEL file from Python (via R)
# RA, 2020-09-12
# A look at the GSE60880:
# Human Lung Fibroblasts treated with TGFbeta, IL1, EGF and small molecule inhibitors of TGFBR1 and p38.
# HLF cells were incubated with each agent for 0.5 hours, 1 hour, 2 hours or 8 hours in standard conditions
# before total RNA was prepared and hybridised to Affymetrix microarrays.
# https://www.ncbi.nlm.nih.gov/geo/query/acc.cgi?acc=GSE60880
from tcga.utils import download
download = download.to(rel_path="download")
@numpde
numpde / xrates.py
Created April 29, 2020 22:23
Download exchange rates
# RA, 2020-04-30
# Download exchange rates -- template
import json
import urllib.request
from retry import retry
from pathlib import Path
@numpde
numpde / the_usual_imports.py
Created January 27, 2020 15:33
The usual "data science" Python imports
import numpy as np
import pandas as pd
import networkx as nx
import re
import json
import pickle
from pathlib import Path
# RA, 2020-01-02
from numpy import sqrt, exp, pi
import numpy as np
from scipy.special import binom
import matplotlib.pyplot as plt
fig: plt.Figure
ax: plt.Axes
@numpde
numpde / markov.py
Last active October 6, 2021 08:23
# RA, 2020-01-01
from numpy import sqrt, exp
import numpy as np
from scipy.special import binom, erf
import matplotlib.pyplot as plt
# Values of b
bb = [0.1, 0.5, 1.5]
@numpde
numpde / usualvenv.sh
Created August 11, 2019 23:05
The usual python venv
virtualenv -p python3.7 venv
source venv/bin/activate
pip install pandas numpy sklearn joblib progressbar2 matplotlib
@numpde
numpde / makefile
Created January 22, 2019 07:22
A mechanism to .gitignore large files but keep a list of them on git
help:
@echo Put this script at the root of the git project.
@echo
@echo Add the following lines to the .gitignore file:
@echo " ""**/UV/**"
@echo " ""!**/UV/unversioned"
@echo
@echo Run
@echo " ""make unversioned"
@echo to create the listings of unversioned files in
@numpde
numpde / update_ip.py
Created January 20, 2019 16:37
Alibaba DNS record update python script
#!/usr/bin/env python3
#coding=utf-8
import subprocess
IP = subprocess.run("dig +short myip.opendns.com @resolver1.opendns.com".split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout.decode('UTF-8').split()[0]
print("IP:", IP)
# https://api.aliyun.com/new#/?product=Alidns&api=UpdateDomainRecord&params={}&tab=DEMO&lang=PYTHON
@numpde
numpde / template_for_datascience.py
Last active October 25, 2018 03:57
A python template for a data science script
#!/usr/bin/python3
# AUTHOR, DATE
## ================== IMPORTS :
pass
import inspect
@numpde
numpde / tunnel.sh
Last active January 17, 2018 12:35
Create an ssh tunnel using a local port
#!/bin/bash
# Suppose you wish to connect to a server X on port 23
# but you have to do this via another server Y like this:
#
# localhost> ssh -p 22 username@Y
# Y> ssh -p 23 username@X
#
# Instead, you can create an ssh tunnel on a local port, say 9999:
# localhost> ssh -nNT -L 9999:X:23 -p 22 username@Y