Skip to content

Instantly share code, notes, and snippets.

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

Taylor Salo tsalo

🏠
Working from home
View GitHub Profile
@effigies
effigies / python_packaging_2020.md
Last active January 25, 2024 13:42
Contemporary Python Packaging - 2020

Contemporary Python Packaging

This document lays out a set of Python packaging practices. I don't claim they are best practices, but they fit my needs, and might fit yours.

Validity

This document has been superseded as of January 2023.

This was written in July 2020, superseding this gist from 2019.

@emdupre
emdupre / hypercommented_v3_selcomps.py
Created November 26, 2018 15:50
Hypercommenting of the v3.2 tedana selection criteria
"""
Functions to identify TE-dependent and TE-independent components.
"""
import json
import logging
import pickle
from nilearn._utils import check_niimg
import numpy as np
from scipy import stats
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vickyqian
vickyqian / twitter crawler.txt
Last active July 23, 2023 16:52
A Python script to download all the tweets of a hashtag into a csv
import tweepy
import csv
import pandas as pd
####input your credentials here
consumer_key = ''
consumer_secret = ''
access_token = ''
access_token_secret = ''
auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
@joelouismarino
joelouismarino / googlenet.py
Last active October 9, 2023 07:09
GoogLeNet in Keras
from __future__ import print_function
import imageio
from PIL import Image
import numpy as np
import keras
from keras.layers import Input, Dense, Conv2D, MaxPooling2D, AveragePooling2D, ZeroPadding2D, Dropout, Flatten, Concatenate, Reshape, Activation
from keras.models import Model
from keras.regularizers import l2
from keras.optimizers import SGD
@cawhitworth
cawhitworth / countdown.py
Last active November 1, 2023 15:57
Countdown solver in Python
import random
add = lambda a,b: a+b
sub = lambda a,b: a-b
mul = lambda a,b: a*b
div = lambda a,b: a/b if a % b == 0 else 0/0
operations = [ (add, '+'),
(sub, '-'),
(mul, '*'),
@hit9
hit9 / colored_logging.py
Created May 23, 2013 11:44
colored python logging. And add a level 'success'
class Color(object):
"""
utility to return ansi colored text.
"""
colors = {
'black': 30,
'red': 31,
'green': 32,
'yellow': 33,
@fajrif
fajrif / gist:1265203
Created October 5, 2011 18:12
git clone specific tag
git clone <repo-address>
git tag -l
git checkout <tag-name>
git branch -D master
git checkout -b master
@brantfaircloth
brantfaircloth / sphinx_to_github.sh
Created January 23, 2011 02:40
Sphinx documentation to github gh-pages without submodules
# assume the following directory structure where contents of doc/
# and source/ are already checked into repo., with the exception
# of the _build directory (i,e. you can check in _themes or _sources
# or whatever else).
#
# proj/
# source/
# doc/
# remove doc/_build/html if present
@grmwld
grmwld / test peak finder scipy
Created January 16, 2011 12:16
detect local maxima.
#!/usr/bin/env python2.7
import scipy.ndimage as ndimage
import numpy
def local_maxima(array, min_distance = 1, periodic=False, edges_allowed=True):
"""Find all local maxima of the array, separated by at least min_distance."""
array = numpy.asarray(array)
cval = 0
if periodic: