This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DECLARE check_running_jobs DEFAULT ( | |
| SELECT IF(COUNT(*) > 1, ERROR('query already running'), NULL) | |
| FROM `region-name`.INFORMATION_SCHEMA.JOBS_BY_PROJECT | |
| WHERE state <> 'DONE' | |
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "encoding/binary" | |
| "fmt" | |
| "hash/maphash" | |
| "math/rand" | |
| ) | |
| type Comparable[T any] interface { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package reflect_test | |
| // Extracted from https://go-review.googlesource.com/c/go/+/401434 | |
| import ( | |
| "fmt" | |
| "reflect" | |
| "unsafe" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package shortstring | |
| import ( | |
| "reflect" | |
| "runtime" | |
| "unsafe" | |
| ) | |
| type shortstring struct { | |
| ptr unsafe.Pointer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <immintrin.h> | |
| static int lut32x(int32_t *inout, __m512i lutk[], __m512i lutv[], int nlut) { | |
| __m512i bin = _mm512_set1_epi32(*inout); | |
| for (int i=0; i<nlut; i++) { | |
| __mmask16 mask = _mm512_cmpeq_epi32_mask(bin, lutk[i]); | |
| if (mask == 0) continue; | |
| __m512i bout = _mm512_maskz_compress_epi32(mask, lutv[i]); | |
| *inout = _mm_extract_epi32(_mm512_extracti32x4_epi32(bout, 0), 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package container | |
| type BijectiveMap[A, B comparable] struct { | |
| m1 map[A]B | |
| m2 map[B]A | |
| } | |
| func (m *BijectiveMap[A, B]) GetB(a A) (B, bool) { | |
| if m.m1 == nil { | |
| var zero B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name La Stampa/Repubblica Adblock Modal Remover | |
| // @name:it La Stampa/Repubblica Elimina Messaggio Adblock | |
| // @namespace http://tampermonkey.net/ | |
| // @version 0.1 | |
| // @description Remove the adblock modal on lastampa.it and repubblica.it | |
| // @description:it Elimina il messaggio modale che impedisce l'uso dei siti di La Stampa (lastampa.it) e Repubblica (repubblica.it) in caso di presenza di adblocker | |
| // @author CAFxX | |
| // @match https://*.lastampa.it/* | |
| // @match https://*.repubblica.it/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import "sync" | |
| import "fmt" | |
| type Work interface { | |
| Process() | |
| } | |
| type WorkFunc func() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // fast file list (linux) | |
| // adapted from https://man7.org/linux/man-pages/man2/getdents.2.html | |
| // gcc -O3 -march=native -o fls fls.c | |
| #define _GNU_SOURCE | |
| #include <dirent.h> /* Defines DT_* constants */ | |
| #include <fcntl.h> | |
| #include <stdint.h> | |
| #include <stdio.h> | |
| #include <unistd.h> | |
| #include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Weak references for Go | |
| // Copyright (C) 2021 Carlo Alberto Ferraris | |
| // | |
| // Based on: | |
| // https://lab.nexedi.com/kirr/neo/blob/bb618ce122423c5ff5fa997c5aafd06819cafe40/go/zodb/internal/weak/weak.go | |
| // | |
| // Original copyright notice: | |
| // | |
| // Copyright (C) 2018 Nexedi SA and Contributors. | |
| // Kirill Smelkov <kirr@nexedi.com> |