Skip to content

Instantly share code, notes, and snippets.

View dlee992's full-sized avatar

Da Li dlee992

  • Greater Chicago Area
  • 16:29 (UTC -06:00)
View GitHub Profile
@DannyWeitekamp
DannyWeitekamp / Numba_Iterator.py
Created September 4, 2022 22:59
Example of writing an iterator for Interval() struct shown in the numba docs
from numba import njit, f8
from numba.typed import List
from numba.extending import models, register_model
class Interval(object):
"""
A half-open interval on the real number line.
"""
def __init__(self, lo, hi):
self.lo = lo
@oquenchil
oquenchil / cc_static_library.bzl
Created October 6, 2021 12:55
Example cc_static_library.bzl
"""Provides a rule that outputs a monolithic static library."""
load("@bazel_tools//tools/cpp:toolchain_utils.bzl", "find_cpp_toolchain")
TOOLS_CPP_REPO = "@bazel_tools"
def _cc_static_library_impl(ctx):
output_lib = ctx.actions.declare_file("{}.a".format(ctx.attr.name))
output_flags = ctx.actions.declare_file("{}.link".format(ctx.attr.name))
@brandonwillard
brandonwillard / both-opt-max-reduce-axis-1.pdf
Last active May 14, 2024 22:40
Numba CAReduce Performance MWE
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gmarkall
gmarkall / output.txt
Last active June 9, 2023 16:45
Numba CUDA Warp-aggregated atomics example. See PR #6911: https://github.com/numba/numba/pull/6911
$ python wagg.py
Running with 16777216 elements, of which approximately 25.0% are zero
There are 12584753 nonzeroes in:
[0.417022 0.72032449 0. ... 0.20570723 0.36716537 0.0979951 ]
The kernel found 12584753 elements, resulting in the array:
[0.14349547 0.43006714 0.48695992 ... 0. 0. 0. ]
Traceback (most recent call last):
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@gyulkkajo
gyulkkajo / c_cpp_properties.json
Last active March 31, 2024 08:42
IntelliSense config file for Linux kernel X86_64.
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${workspaceFolder}",
"LINUX_PATH/include",
"LINUX_PATH/include/uapi",
"LINUX_PATH/include/generated",
"LINUX_PATH/arch/x86/include",
@sklam
sklam / If_else.ipynb
Created December 5, 2017 16:16
llvmlite builder.if_else & phi example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SKempin
SKempin / Git Subtree basics.md
Last active June 27, 2024 07:56
Git Subtree basics

Git Subtree Basics

If you hate git submodule, then you may want to give git subtree a try.

Background

When you want to use a subtree, you add the subtree to an existing repository where the subtree is a reference to another repository url and branch/tag. This add command adds all the code and files into the main repository locally; it's not just a reference to a remote repo.

When you stage and commit files for the main repo, it will add all of the remote files in the same operation. The subtree checkout will pull all the files in one pass, so there is no need to try and connect to another repo to get the portion of subtree files, because they were already included in the main repo.

Adding a subtree

Let's say you already have a git repository with at least one commit. You can add another repository into this respository like this:

Revisiting Tagless Final Interpreters

Tageless Final interpreters are an alternative to the traditional Algebraic Data Type (and generalized ADT) based implementation of the interpreter pattern. This document presents the Tageless Final approach with Scala, and shows how Dotty with it's recently added implicits functions makes the approach even more appealing. All examples are direct translations of their Haskell version presented in the Typed Tagless Final Interpreters: Lecture Notes (section 2).

The interpreter pattern has recently received a lot of attention in the Scala community. A lot of efforts have been invested in trying to address the biggest shortcomings of ADT/GADT based solutions: extensibility. One can first look at cats' Inject typeclass for an implementation of [Data Type à la Carte](http://www.cs.ru.nl/~W.Swierstra/Publications/DataTypesA

@LeCoupa
LeCoupa / bash-cheatsheet.sh
Last active July 16, 2024 17:25
Bash CheatSheet for UNIX Systems --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04