Skip to content

Instantly share code, notes, and snippets.

View lesolorzanov's full-sized avatar
:shipit:

Leslie Evelyn Solorzano lesolorzanov

:shipit:
  • Uppsala, Sweden
View GitHub Profile
@CGArtPython
CGArtPython / hex_color_to_rgba.py
Last active January 11, 2024 21:52
A Blender Python script to convert HEX colors to Blender RGB; Video tutorial: https://www.youtube.com/watch?v=knc1CGBhJeU
# give Python access to Blender's functionality
import bpy
# extend Python's math functionality
import math
def hex_color_to_rgba(hex_color):
# remove the leading '#' symbol
hex_color = hex_color[1:]
@petebankhead
petebankhead / QuPath-Import qpdata files to project.groovy
Created August 14, 2020 14:39
Import images from .qpdata files into a new project in QuPath v0.2.x.
/**
* Import images from .qpdata files into a new project in QuPath v0.2.x.
*
* The purpose of this is to help recover data from files that were saved outside a project.
* It may not work for all images, but should work for most 'straightforward' examples (i.e. a single image per image file).
*
* If your .qpdata files are already part of a v0.1.2 project, use 'File -> Project... -> Import images from v0.1.2' instead.
* If your .qpdata files are already part of a v0.2.0 project, use 'File -> Project... -> Add images' and add the .qpproj file instead.
*
* Warning! This hasn't been very extensively tested (I always use projects from the start...).
// Processing code by Etienne JACOB
// motion blur template by beesandbombs
// opensimplexnoise code in another tab might be necessary
// --> code here : https://gist.github.com/Bleuje/fce86ef35b66c4a2b6a469b27163591e
int[][] result;
float t, c;
float ease(float p) {
return 3*p*p - 2*p*p*p;
@alejandro-martin
alejandro-martin / multiple-ssh-keys-git.adoc
Last active May 2, 2024 22:56
Configure multiple SSH Keys for Git

Use Multiple SSH Keys for Git host websites (Github, Gitlab)

This is guide about how to configure multiple SSH keys for some Git host websites such as Github, Gitlab, among others.

Creating SSH keys

  1. Create SSH directory:

@Svidro
Svidro / !Changing colors in QuPath
Last active March 29, 2023 19:08
Color changes in QuPath
Collections of scripts to alter object colors harvested mainly from Pete, but also picked up from the forums
TOC
Change IF channel color.groovy - Change the LUT for individual channels. Does not work with OpenSlide servers (check Image tab).
Change colors by subclass.groovy - Detection object color adjustment when using subclasses.
Change subcellular detection color - Hugely useful when working with subcellular detections as, by default, they are a derived class
and cannot be altered directly through the Annotation tab interface.
@J535D165
J535D165 / crop_resize.py
Created January 7, 2018 11:28
crop and resize numpy array
from scipy import interpolate
def crop_and_resample_2darray(arr, x_crop, y_crop, resample, *args, **kwargs):
"""Crop a 2darray and resize the data"""
len_x_crop = x_crop[1]-x_crop[0]
len_y_crop = y_crop[1]-y_crop[0]
arr_crop = arr[x_crop[0]:x_crop[1], y_crop[0]:y_crop[1]]
f = interpolate.interp2d(np.arange(len_y_crop),
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active April 30, 2024 12:39
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@RiseupDev
RiseupDev / index.html
Last active April 17, 2023 15:48
D3.js draw a polygon with mouse
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>D3 Drawing</title>
<script src="https://cdn.jsdelivr.net/d3js/3.5.9/d3.min.js"></script>
</head>
<body>
<h3>Draw a polygon :D</h3>
<script>
@robintw
robintw / orthoregress.py
Created November 1, 2015 12:01
Orthogonal distance regression in Python, with the same interface as the linregress function
# Copyright (c) 2013, Robin Wilson
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
@NoUsername
NoUsername / imageViewer.html
Created March 2, 2014 15:38
Simple image viewer, which loads all images from an html directory listing.
<html>
<head>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<img id="viewer" src="" width="800px"/>
<div id="info"> </div>
<script>
$(function() {