Skip to content

Instantly share code, notes, and snippets.

View JotaRata's full-sized avatar
💥

JotaRata

💥
  • 06:34 (UTC -03:00)
View GitHub Profile
@JotaRata
JotaRata / ztfutils.py
Last active June 27, 2024 01:12
ZTF Forced Photometry service utilities
import math
import re
from typing import Literal
import numpy as np
import pandas as pd
import requests
import multiprocessing
from multiprocessing.pool import ThreadPool
import os
@JotaRata
JotaRata / stubs.py
Last active August 1, 2023 01:05
Auto stub generator for Cython files
'''
Auto stub generator for cython files.
LIMITATIONS:
Can only parse declared cdef variables with public/readonly keywords
Cannot parse plain defined variables (ex: "my_var = 2")
Cannot parse special members imported from C/C++
Cannot parse ctypedef types
Can only parse functions prefixed with 'def' and 'cpdef
@Anthelmed
Anthelmed / WorldSpaceUIDocument.cs
Last active November 7, 2024 07:31
Until Unity decide to make it official, this is a custom WorldSpaceUIDocument component. Code is under the MIT license: https://github.com/git/git-scm.com/blob/main/MIT-LICENSE.txt
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Rendering;
using UnityEngine.UIElements;
#if ENABLE_INPUT_SYSTEM
using UnityEngine.InputSystem.UI;
#endif
#if UNITY_EDITOR
using UnityEditor;
@JotaRata
JotaRata / TextEditor.cs
Last active April 26, 2024 21:14
A really really simple text editor for Unity
/*
This is a really simple text editor to be used within Unity
It's useful to write memos, notes or ideas inside your Unity Editor window
Kinda like Blender's Text Editor
*/
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
@ljw1004
ljw1004 / tuple_perf.cs
Created April 20, 2017 15:02
Perf comparison ValueTuple vs Tuple vs KeyValuePair
// TUPLE MICRO-BENCHMARKS, based on https://www.dotnetperls.com/tuple-keyvaluepair
//
// Tuples are generally fastest.
// ValueTuple is fastest in the particular case of GetHashCode.
// KeyValuePair is always worst.
//
//
// RAW RESULTS
// Numbers in milliseconds (lower is better)
//
@jhazelwo
jhazelwo / fail.py
Last active December 31, 2023 20:59
Supress traceback for custom Python exceptions
#!/usr/bin/env python3
""" -*- coding: utf-8 -*-
Example Python3 Raise Exception without Traceback
Example Python3 Hide Traceback
Python3 Custom Exception Class
Python3 custom exception suppress traceback example
Python3 custom exception without traceback example
Example Python Raise Exception without Traceback
Example Python Hide Traceback
Python Custom Exception Class
@uchida
uchida / enumerate.cs
Created November 28, 2011 13:55
C# sample code for equivalent of python enumerate()
// GWLlosa's answer in http://stackoverflow.com/questions/521687/c-sharp-foreach-with-index
using System;
using System.Collections.Generic;
using System.Linq;
namespace EnumerateTest {
class Program {
static void Main(string[] args) {
List<int> list = new List<int> {4, 2, 3, 1, 8};