Skip to content

Instantly share code, notes, and snippets.

View danieldk's full-sized avatar

Daniël de Kok danieldk

View GitHub Profile
from typing import Optional, Callable, Any, Tuple
from ..model import Model
from ..util import use_nvtx_range
def with_nvtx_range(
layer: Model,
name: Optional[str] = None,
*,
@danieldk
danieldk / update-cargo-hashes.txt
Last active January 26, 2025 03:43
Rough procedure for updating all cargoSha256/cargoHash
Rough procedure for updating cargo hashes. Warning: this still requires a lot
of manual work to cover all bases. Based on:
https://github.com/NixOS/nixpkgs/pull/112764/commits/2650d5d2b8c19844224f8b368887153e2f18fdae
# Invalidate all hashes
rg -l "cargoHash" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoHash = "..../cargoHash = "sha256-1234/g'
rg -l "cargoSha256" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoSha256 = "[^s].../cargoSha256 = "1234/g'
rg -l "cargoSha256" | grep "\.nix" | xargs -n1 sed -i -re 's/cargoSha256 = "sha256-..../cargoSha256 = "sha256-1234/g'
import torch
from torch import nn
class TensorModule(nn.Module):
def __init__(self, tensors):
super(TensorModule, self).__init__()
for tensor_name, tensor in tensors.items():
setattr(self, tensor_name, nn.Parameter(tensor))
{ stdenv
, fetchFromGitLab
, autoreconfHook
, pkg-config
, intltool
, itstool
, mono
, yelp-tools
, wrapGAppsHook
, enchant1
diff --git a/pkgs/development/libraries/utf8cpp/default.nix b/pkgs/development/libraries/utf8cpp/default.nix
index f42baa2576a..a2aac1241cd 100644
--- a/pkgs/development/libraries/utf8cpp/default.nix
+++ b/pkgs/development/libraries/utf8cpp/default.nix
@@ -8,17 +8,20 @@ stdenv.mkDerivation rec {
owner = "nemtrif";
repo = "utfcpp";
rev = "v${version}";
- sha256 = "1d5p9l27mxhsmm4zlxjsbxngsmr5yxrzi66x550bf5g92sj52ffc";
+ fetchSubmodules = true;
import math
import random
FAC3 = 6.
FAC5 = 120.
FAC7 = 5040.
def poorMenSine(x):
return x - (x ** 3 / FAC3) + (x ** 5 / FAC5) - (x ** 7 / FAC7)
--- /nix/store/nbkx2qghlh05dscldwxbrbbjm0jl2xws-bert-base-german-cased-vocab.txt 1970-01-01 01:00:01.000000000 +0100
+++ bert-base-german-cased-vocab.txt 2020-04-16 11:38:36.000000000 +0200
@@ -121,7 +121,7 @@
ver
##ls
Z
-(
+[unused_punctuation4]
##ir
Die
--- wc.c 2019-11-21 06:57:27.995567360 +0100
+++ wc3.c 2019-11-21 08:05:08.386223937 +0100
@@ -137,11 +137,10 @@
struct stat sb;
uintmax_t linect, wordct, charct;
int fd, len, warned;
- size_t clen;
short gotsp;
u_char *p;
u_char buf[MAXBSIZE];
diff --git a/crate2nix.nix b/crate2nix.nix
index bca75df..9e0d364 100644
--- a/crate2nix.nix
+++ b/crate2nix.nix
@@ -178,6 +178,7 @@ rec {
dependencies = {
"getrandom" = {
packageId = "getrandom 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)";
+ rename = "getrandom_package";
optional = true;
diff --git a/pkgs/build-support/rust/build-rust-crate/build-crate.nix b/pkgs/build-support/rust/build-rust-crate/build-crate.nix
index 2999c3d4c1d..d3f9ded4a04 100644
--- a/pkgs/build-support/rust/build-rust-crate/build-crate.nix
+++ b/pkgs/build-support/rust/build-rust-crate/build-crate.nix
@@ -3,11 +3,11 @@
dependencies,
crateFeatures, libName, release, libPath,
crateType, metadata, crateBin, hasCrateBin,
- extraRustcOpts, verbose, colors }:
+ extraRustcOpts, verbose, colors, renames }: