Skip to content

Instantly share code, notes, and snippets.

View YiqinZhao's full-sized avatar
🎯
Focusing

Yiqin Zhao YiqinZhao

🎯
Focusing
View GitHub Profile
@Sunmish
Sunmish / fluxtools.py
Last active April 7, 2024 16:59
Measure integrated flux densities in images.
# TODO:
# Add precision options. Currently values are returned at arbitrary precision.
# Add `strip_extra_axes` function for use when reading in FITS images.
# Clean up read_fits and associated FITS file handling functions.
# Fix up documentation.
# This code is years worth of additions and changes that represent my own 'journey' in learning python
# and studying radio astronomy - so some (a lot) of it is horribly ineffecient.
import numpy as np
@Lucifier129
Lucifier129 / monadic-functional-observable.js
Created March 30, 2019 13:16
monadic functional observable supports pullable and pushable
const identity = x => x
const noop = () => {}
const pipe = (...args) => args.reduce((a, f) => f(a))
const create = producer => sink => {
let isFinish = false
let wrap = f => a => {
if (isFinish) return
if (f) f(a)
@YiqinZhao
YiqinZhao / bastard.py
Last active December 5, 2018 12:19
GPU Bastard, control the resource belong to you!
import os
import time
import argparse
import GPUtil
from multiprocessing import Process
parser = argparse.ArgumentParser(description='GPU Bastard, control the resource belong to you!')
parser.add_argument('--index',
help='GPU Index',
@tarukosu
tarukosu / cameraToWorld.cs
Last active November 30, 2022 17:40
HoloLens カメラ座標から世界座標への変換
void OnPhotoCaptured(PhotoCapture.PhotoCaptureResult result, PhotoCaptureFrame photoCaptureFrame)
{
Matrix4x4 cameraToWorldMatrix;
photoCaptureFrame.TryGetCameraToWorldMatrix(out cameraToWorldMatrix);
Matrix4x4 projectionMatrix;
photoCaptureFrame.TryGetProjectionMatrix(out projectionMatrix);
var imagePosZeroToOne = new Vector2(pixelPos.x / imageWidth, 1 - (pixelPos.y / imageHeight));
var imagePosProjected = (imagePosZeroToOne * 2) - new Vector2(1, 1); // -1 to 1 space
@ditzel
ditzel / KdTree.cs
Last active June 14, 2024 19:13
k-d Tree
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Profiling;
public class KdTree<T> : IEnumerable<T>, IEnumerable where T : Component
{
protected KdNode _root;
protected KdNode _last;
@chenxiaolong
chenxiaolong / DellXPS15_9560_AHCI_RAID.md
Created November 27, 2017 01:33
Switching between AHCI and RAID on the Dell XPS 15 (9560)

Switching between AHCI and RAID on the Dell XPS 15 (9560)

This guide likely applies to other models and, potentially, even laptops from other OEMs that have NVME drives. However, I've only tested this on my Dell XPS 15 (9560) with the OEM Windows installation from the Signature Edition model.

Switching from RAID to AHCI

Switching from RAID to AHCI is significantly simpler than switching from AHCI to RAID. All that's needed is a successful boot to Safe Mode.

  1. To set the default boot mode to Safe Mode, use msconfig.exe or open an admin cmd/PowerShell window and run:
@JoshuaSullivan
JoshuaSullivan / CapturedImageSampler.swift
Created October 1, 2017 01:38
The source code for an object that helps you sample RGB values from ARFrames.
//
// CapturedImageSampler.swift
// ARKitTest
//
// Created by Joshua Sullivan on 9/22/17.
// Copyright © 2017 Joshua Sullivan. All rights reserved.
//
import UIKit
import ARKit
@dbarnes
dbarnes / OSX Sierra + Titan Xp eGPU. Tensorflow 1.2.1. + CUDA 8 + cuDNN 6.md
Last active March 28, 2020 19:23
OSX Sierra + Titan Xp eGPU. Tensorflow 1.2.1. + CUDA 8 + cuDNN 6

OSX Sierra + Titan Xp eGPU. Tensorflow 1.2.1. + CUDA 8 + cuDNN 6

This gist summarises the tensorflow related steps I took to get the above combo working.

When its all tested in c++ I'll update the instructions fully (and add anything I forgot below).

But in summary ( with the current master dd06643cf098ed362212ce0f76ee746951466e81 ):

I have uploaded the pip wheel which I believe should work if you have the same setup but no promises (built for compute capability 3.5, 5.2, 6.0 and named tensorflow-gpu). Install with (not sure dropbox allows this direct linking):

@clivetyphon
clivetyphon / easy-client-vpn-strongswan.md
Last active March 23, 2023 09:09
Easy client VPN for all major platforms using strongSwan IPsec

Easy client VPN for all major platforms using strongSwan IPsec

Overview

The goal here is to provide quick and easy but secure client VPN that can be configured natively without any additional software on:

  • Linux
  • iOS
  • Android
  • Windows
  • OSX