Skip to content

Instantly share code, notes, and snippets.

from nilearn import datasets
from nilearn.input_data import NiftiLabelsMasker as NLM
# your rawdata filename
filename = './tfMRI_EMOTION_RL.nii.gz'
# download the atlas, which has two attributes: dataset.maps, dataset.labels
dataset = datasets.fetch_atlas_destrieux_2009()
@com3345
com3345 / graph_drawing_animation.py
Created September 12, 2016 00:20
graph drawing animation
import matplotlib.pyplot as plt
from matplotlib import animation
import networkx as nx
import os
import time
os.chdir('/Users/Cosann/Downloads/initial_graph_gml')
filenames = os.listdir('.')
filename = filenames[0]
@com3345
com3345 / untitled.py
Created January 10, 2018 12:08
indeed interview
'''
moving avg,就是一个stream输入,
给一个int getNow()API获取当前timestamp,
完成两个函数void record(int value)和double getAvg(),
有输入时会自动call record,然后call getAvg()时返回5分钟内的平均值。
getMedium -> quick select
'''
from collections import deque
@com3345
com3345 / stocklist.txt
Created January 10, 2018 12:22
股票列表
浦发银行
白云机场
东风汽车
中国国贸
首创股份
上海机场
包钢股份
华能国际
皖通高速
华夏银行
@com3345
com3345 / interview2.py
Created January 10, 2018 12:26
indeed interview2
def summmaryranges(nums):
ranges = []
for num in nums:
if not ranges or num - ranges[-1][-1] > 1:
ranges.append([])
ranges[-1][1:] = [num]
return ['->'.join(map(str, r)) for r in ranges]
def reverse(l, r, cl):
while l < r: