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
@endolith
endolith / A_weighting.py
Last active July 26, 2024 09:32
A-weighting audio files in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Translated from a MATLAB script (which also includes C-weighting, octave
and one-third-octave digital filters).
Author: Christophe Couvreur, Faculte Polytechnique de Mons (Belgium)
couvreur@thor.fpms.ac.be
Last modification: Aug. 20, 1997, 10:00am.
BSD license
@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:
@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
@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
@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,
@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, '*'),
@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
@vickyqian
vickyqian / twitter crawler.txt
Last active May 11, 2024 16:19
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)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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