Skip to content

Instantly share code, notes, and snippets.

@teh
teh / autogluon.nix
Created October 1, 2023 09:48
autogluon nixpkgs
{ lib
, buildPythonPackage
, fetchFromGitHub
, networkx
, tqdm
, scipy
, pandas
, lightgbm
, catboost
, xgboost
# source: https://google.github.io/bi-tempered-loss/
# apache 2 licensed
import torch
def logT(u, t):
if t == 1:
return torch.log(u)
else:
return (torch.pow(u, 1.0 - t) - 1.0) / (1.0 - t)
@teh
teh / Main.hs
Last active August 2, 2017 21:05
module Main where
main = print "hi"
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE TypeOperators #-}
import GHC.Base (Type)
The invocation of "nix-build --keep-going -A python27Packages.sphinx-jinja -A python27Packages.anyjson -A qt5.qtwebchannel -A axis2 -A python35Packages.minimock -A kde4.semnotes -A faust2lv2gui -A python35Packages.actdiag -A xfce.xfce4_netload_plugin -A kde4.kremotecontrol -A skype_call_recorder -A prison -A mono46 -A python27Packages.traits -A kde5.kdenlive -A kde5.l10n.it.qt4 -A python35Packages.github3_py -A mfcj6510dw-cupswrapper -A python35Packages.oauthlib -A python35Packages.gst-python -A msilbc -A kde4.l10n.nds -A python35Packages.topydo -A kde4.zanshin -A kde5.l10n.wa.qt4 -A fcitx-engines.libpinyin -A mediastreamer-openh264 -A rili -A R -A xorg.xf86inputjoystick -A xpilot-ng -A atanks -A linuxPackages_chromiumos_3_18.nvidia_x11 -A kde4.kfourinline -A python35Packages.carrot -A python27Packages.pytest_xdist -A compton -A opkg -A kde4.kamera -A puddletag -A gnome3.networkmanager_openvpn -A python35Packages.pyramid_debugtoolbar -A glabels -A python27Packages.clepy -A plantuml -A SDL2_gfx -A python27Pack
module X where
import Prelude
import Data.Foreign (F)
import Data.Foreign.Class (class IsForeign, readJSON, readProp)
import Data.Foreign.Index (prop)
import Control.Monad.Eff.Console (logShow)
import Data.Either (Either(..))
-- { repo(owner: “tom”, name: “holborn”)
@teh
teh / typeapp.hs
Last active September 29, 2016 12:14
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE AllowAmbiguousTypes #-}
{-# LANGUAGE DataKinds, PolyKinds, TypeOperators #-}
{-# LANGUAGE TypeFamilies, FlexibleInstances #-}
{-# LANGUAGE InstanceSigs #-}
-- When do I need TypeApplication?
-- When I need some intermediate types that change how
import sklearn.base as base
import sklearn.linear_model as lm
import numpy
class ByThreshold(base.BaseEstimator, base.ClassifierMixin):
def __init__(self, estimator, threshold=0.95):
self.threshold = threshold
self.estimator = estimator
@teh
teh / stack.py
Last active August 24, 2016 14:10
#!/usr/bin/env python
"""
Welcome to Tom-does-another-disgusting-hack.
This is an executable shim for the stack binary whose only purpose is
to make the amazing intero mode [1] work in a non-stack environment (Nix
in our case).
Dump it somewhere and make sure it runs *instead* of the actual stack binary.
You will not be able to use stack at the same time.
#!/usr/bin/env python
import sys
import time
import os
import subprocess
def main():
if sys.argv[1:] == ["path", "--project-root", "--verbosity", "silent"]:
print "/home/tom/src/intero"