Skip to content

Instantly share code, notes, and snippets.

View westwin's full-sized avatar
🎯
Focusing

westwin westwin

🎯
Focusing
View GitHub Profile
@mostafa-hz
mostafa-hz / generate-pagination-query.js
Last active May 27, 2023 18:57
A function to generate keyset paginated queries for mongodb
function generatePaginationQuery(query, sort, nextKey) {
const sortField = sort == null ? null : sort[0];
function nextKeyFn(items) {
if (items.length === 0) {
return null;
}
const item = items[items.length - 1];
@ismasan
ismasan / sse.go
Last active March 19, 2024 18:13
Example SSE server in Golang
// Copyright (c) 2017 Ismael Celis
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in all
@landonf
landonf / setcert.sh
Last active March 3, 2023 08:54
opendj certificate configuration
#!/bin/sh
args=`getopt p:c:t:o:a: $*`
if [ $? != 0 ]; then
echo 'Usage: ...'
exit 2
fi
set -- $args
for i; do