Skip to content

Instantly share code, notes, and snippets.

View ahundt's full-sized avatar

Andrew Hundt ahundt

View GitHub Profile
@boxabirds
boxabirds / .cursorrules
Last active June 6, 2025 06:01
Rock solid: turn Cursor into a rock-solid software engineering companion
# Project Policy
This policy provides a single, authoritative, and machine-readable source of truth for AI coding agents and humans, ensuring that all work is governed by clear, unambiguous rules and workflows. It aims to eliminate ambiguity, reduce supervision needs, and facilitate automation while maintaining accountability and compliance with best practices.
# 1. Introduction
> Rationale: Sets the context, actors, and compliance requirements for the policy, ensuring all participants understand their roles and responsibilities.
## 1.1 Actors
@rmcelreath
rmcelreath / prior_likelihood_conflict.r
Created September 11, 2023 11:29
Demonstration of how normal and student-t distributions interact in Bayesian updating
# prior - likelihood conflict
library(rethinking)
yobs <- 0
mtt <- ulam(
alist(
y ~ dstudent(2,mu,1),
mu ~ dstudent(2,10,1)
@guilhermepontes
guilhermepontes / readme.md
Last active November 27, 2022 21:02
Get the old VSCode back on macOS

Get the old VSCode icon back!! 🔥 🔥

First download the new old icon: https://cl.ly/mzTc (based on this)

You can also use the icon you want, but you need to convert it to .icns. You can use this service to convert PNG to ICNS.

Go to Applications and find VSCode, right click there and choose Get Info. Drag 'n drop the new icon.

class weighted_categorical_crossentropy:
def __init__(self, weights):
self.weights = weights
self.__name__ = 'wcentroid_loss'
def __call__(self, y_true, y_pred):
class0 = K.ones_like(y_pred)[:, :, :, 0] * self.weights[0]
class1 = K.ones_like(y_pred)[:, :, :, 0] * self.weights[1]
x = K.tf.where(y_true[:, :, :, 0] > 0, class0, class1)
result = x * K.categorical_crossentropy(y_pred, y_true)
@eldar
eldar / tf-resnet-fcn.py
Last active September 11, 2017 06:20
import datetime as dt
import tensorflow as tf
import tensorflow.contrib.slim as slim
from tensorflow.contrib.slim.nets import resnet_v1
import threading
from PoseDataset import PoseDataset
from TrainParams import TrainParams
import tensorflow as tf
from tensorflow.python.framework import ops
import numpy as np
# Define custom py_func which takes also a grad op as argument:
def py_func(func, inp, Tout, stateful=True, name=None, grad=None):
# Need to generate a unique name to avoid duplicates:
rnd_name = 'PyFuncGrad' + str(np.random.randint(0, 1E+8))
@kastnerkyle
kastnerkyle / pascalvoc.py
Last active June 4, 2018 21:41
Wrapper to read pascal voc data
# Author: Kyle Kastner # License: BSD 3-Clause # For a reference on parallel processing in Python see tutorial by David Beazley # http://www.slideshare.net/dabeaz/an-introduction-to-python-concurrency # Loosely based on IBM example # http://www.ibm.com/developerworks/aix/library/au-threadingpython/ # If you want to download all the PASCAL VOC data, use the following in bash... """ #! /bin/bash # 2008 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2008/VOCtrainval_14-Jul-2008.tar # 2009 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2009/VOCtrainval_11-May-2009.tar # 2010 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2010/VOCtrainval_03-May-2010.tar # 2011 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2011/VOCtrainval_25-May-2011.tar # 2012 wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCtrainval_11-May-2012.tar # Latest devkit wget http://host.robots.ox.ac.uk/pascal/VOC/voc2012/VOCdevkit_18-May-2011.tar """ try: import Queue except ImportError: import queue as Queue import threading import ti
@djsutherland
djsutherland / fix_paths.sh
Last active February 13, 2016 22:50
Patch up Caffe's paths to avoid need for DYLD_FALLBACK_LIBRARY_PATH on OSX El Capitan, which doesn't really support it anymore
#!/bin/bash
CUDA_LIB_DIR=/usr/local/cuda/lib
CUDA_VERSION=7.5
CUDA_LIBS="cublas cudart curand"
CUDNN_LIB_DIR=/usr/local/cuda/cudnn-3/lib
CUDNN_VERSION=7.0
CUDNN_LIBS="cudnn"
@zchee
zchee / How-to-building-CUDA7.5-with-clang7.0.0.md
Last active August 15, 2017 23:51
How to compiling use CUDA nvcc with Xcode7.0 clang 7.0.0

CUDA7.5

Now, CUDA did not compatible Apple clang 7.0.0 also Xcode7.0.

e.g,

> cd /Developer/NVIDIA/CUDA-7.5/samples/0_Simple/asyncAPI

> clang -v
Apple LLVM version 7.0.0 (clang-700.1.75)
@willurd
willurd / web-servers.md
Last active June 3, 2025 15:43
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000