Skip to content

Instantly share code, notes, and snippets.

View ilkayisik's full-sized avatar

Ilkay Isik ilkayisik

View GitHub Profile
@ilkayisik
ilkayisik / convert_image.py
Created January 24, 2022 14:02
convert_image.py
from PIL import Image
im = Image.open('Foto.jpg')
im.save('Foto.png')
@ilkayisik
ilkayisik / conda_env_share
Last active August 31, 2024 00:38
Sharing a conda environment
# Exporting the environment.yml file
# Activate the environment to export:
conda activate myenv
# go to the directory where you want the newly created .yml file to be
cd /Users/ilkayisik/Desktop/
# Export your active environment to a new file
conda env export > environment.yml
@ilkayisik
ilkayisik / square_matrix_from_vector.py
Last active February 19, 2021 10:40
two ways of making a square matrix from a vector
'''make square matrix from vector'''
import numpy as np
nr_elems = 253
vals = np.random.rand(nr_elems)
# first method using scipy distance:
from scipy.spatial import distance
vals_square_1 = distance.squareform(vals)
@ilkayisik
ilkayisik / rsync_cmd.sh
Created April 18, 2020 15:44
command to sync external hard disk to local
# local to external hd
rsync -azP --delete /Users/ilkay.isik/project_folder_temp/fc_content/MRI_data/lscp_data /Volumes/ilkay_iMAC
# external hd to local
rsync -azP --delete /Volumes/ilkay_iMAC /Users/ilkay.isik/project_folder_temp/fc_content/MRI_data/lscp_data
cd /path
convert -delay 50 -loop 0 cope6*.png cope6_gif.gif
# favorite jupyter notebook themes
#https://github.com/dunovank/jupyter-themes
# light
jt -r # restore default theme
jt -t grade3 -f roboto -fs 12 -ofs 11 -cellw 90% -lineh 130 -T -N
jupyter notebook
# dark can also be onedork
1 - cdf('t', tval, df)
@ilkayisik
ilkayisik / remove_elements_starts_with.py
Created February 3, 2020 16:36
remove list element that starts with a certain expression
labels = ['pericalc','FFA','MT','comb_a','comb_b']
comb_ind = [labels.index(l) for l in labels if l.startswith('comb')]
len_comb = len(comb_ind)
arr = np.arange(len(labels))
arr = list(arr[~np.isin(arr, comb_ind)])
labels = [i for j, i in enumerate(labels) if j in arr]
mask = np.zeros([18, 18, 1, 4])
for i in range(mask.shape[3]):
mask[:, :, 0, :] = ipl_mask
no_mask = np.zeros_like(mask)
k = 0
mask_all_sub = np.zeros_like(four_dim_array)
for s, sub in enumerate(sub_list):
if sub in missing_roi_sub:
@ilkayisik
ilkayisik / bash_read_pipe_withawk.sh
Last active January 28, 2020 11:58
Example script containing several important operations in bash
#!/bin/bash
# How to skip the first line while using read,
# how to check a value and increment based on the value of another variable,
# pipe a value from bash to awk to parse the line and get the value as a variable to use in another bash command
PREVCINDEX=99999
i=1 # skip the first line (part 1)
while read LINE
do
test $i -eq 1 && ((i=i+1)) && continue # skip the first line (part 2)