Skip to content

Instantly share code, notes, and snippets.

View rkettelerij's full-sized avatar

Richard Kettelerij rkettelerij

View GitHub Profile
@alexcastillo
alexcastillo / whilePageIsVisible.js
Created August 17, 2020 19:02
RxJS pipe: whilePageIsVisible
import { fromEvent, partition, pipe } from "rxjs";
import { shareReplay, takeUntil, repeatWhen } from "rxjs/operators";
// 🛑 unsubscribes when the browser tab is not active
// ✅ resubscribe when it is becomes active again
export function whilePageIsVisible() {
const visibilityChange$ = fromEvent(document, "visibilitychange").pipe(
shareReplay({ refCount: true, bufferSize: 1 })
);
@sleeyax
sleeyax / go2c.md
Last active August 23, 2024 06:03
CGO <-> C conversions list
Type C Call method Go type Bytes (byte) Numerical range
char C.char byte 1 -128~127
signed char C.schar int8 1 -128~127
unsigned char C.uchar uint8 1 0~255
short int C.short int16 2 -32768~32767
short unsigned int C.ushort uint16 2 0~65535
int C.int int 4 -2147483648~2147483647
unsigned int C.uint uint32 4 0~4294967295
long int C.long int32 or int64 4 -2147483648~2147483647
@spuder
spuder / LICENSE
Last active May 22, 2023 17:10
Script to help recover nomad servers that have lost leadership
Mozilla Public License, version 2.0
1. Definitions
1.1. "Contributor"
means each individual or legal entity that creates, contributes to the
creation of, or owns Covered Software.
1.2. "Contributor Version"
@CAFxX
CAFxX / golang_minimize_allocations.md
Last active August 7, 2024 23:44
Minimize allocations in Go

📂 Minimize allocations in Go

A collection of tips for when you need to minimize the number of allocations in your Go programs.

Use the go profiler to identify which parts of your program are responsible for most allocations.

⚠️ Never apply these tricks blindly (i.e. without measuring the actual performance benefit/impact). Most of these tricks cause a tradeoff between reducing memory allocations and other aspects (including e.g. higher peak memory usage, higher CPU usage, lower maintainability, higher probability of introducing subtle bugs). Only apply these tricks if the tradeoff in every specfic case is globally positive.

Protobuf

@LayZeeDK
LayZeeDK / angular-cli-node-js-typescript-rxjs-compatiblity-matrix.csv
Last active August 30, 2024 13:03
Angular CLI, Angular, Node.js, TypeScript, and RxJS version compatibility matrix. Officially part of the Angular documentation as of 2023-04-19 https://angular.io/guide/versions
Angular CLI version Angular version Node.js version TypeScript version RxJS version
~16.0.0 ~16.0.0 ^16.13.0 || ^18.10.0 >=4.9.5 <5.1.0 ^6.5.5 || ^7.4.0
~15.2.0 ~15.2.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.1.0 ~15.1.0 ^14.20.0 || ^16.13.0 || ^18.10.0 >=4.8.4 <5.0.0 ^6.5.5 || ^7.4.0
~15.0.5 ~15.0.4 ^14.20.0 || ^16.13.0 || ^18.10.0 ~4.8.4 ^6.5.5 || ^7.4.0
~14.3.0 ~14.3.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.2.0 ~14.2.0 ^14.15.0 || ^16.10.0 >=4.6.4 <4.9.0 ^6.5.5 || ^7.4.0
~14.1.3 ~14.1.3 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~14.0.7 ~14.0.7 ^14.15.0 || ^16.10.0 >=4.6.4 <4.8.0 ^6.5.5 || ^7.4.0
~13.3.0 ~13.3.0 ^12.20.2 || ^14.15.0 || ^16.10.0 >=4.4.4 <4.7.0 ^6.5.5 || ^7.4.0
@alexellis
alexellis / arm.md
Last active May 28, 2024 14:48
Test swarm connectivity

Regular PC / cloud architecture (64-bit)

See the snippets "guide.md" and "redis.md" below.

Swarm on a Raspberry Pi

If you're wanting to run Docker Swarm on your Raspberry Pi checkout these instructions:

@zchee
zchee / cgo.md
Last active July 14, 2024 14:58
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@chrismdp
chrismdp / s3.sh
Last active September 13, 2024 12:53
Uploading to S3 in 18 lines of Shell (used to upload builds for http://soltrader.net)
# You don't need Fog in Ruby or some other library to upload to S3 -- shell works perfectly fine
# This is how I upload my new Sol Trader builds (http://soltrader.net)
# Based on a modified script from here: http://tmont.com/blargh/2014/1/uploading-to-s3-in-bash
S3KEY="my aws key"
S3SECRET="my aws secret" # pass these in
function putS3
{
path=$1