Skip to content

Instantly share code, notes, and snippets.

View maxpert's full-sized avatar

Zohaib Sibte Hassan maxpert

View GitHub Profile
@maxpert
maxpert / Crc64.cs
Created April 11, 2016 16:40
CRC64 implementation C#
public class Crc64
{
private static readonly ulong[] Table = {
0x0000000000000000, 0x7ad870c830358979,
0xf5b0e190606b12f2, 0x8f689158505e9b8b,
0xc038e5739841b68f, 0xbae095bba8743ff6,
0x358804e3f82aa47d, 0x4f50742bc81f2d04,
0xab28ecb46814fe75, 0xd1f09c7c5821770c,
0x5e980d24087fec87, 0x24407dec384a65fe,
0x6b1009c7f05548fa, 0x11c8790fc060c183,
@maxpert
maxpert / piratebay_index.py
Created September 25, 2012 13:14
Quick and dirty Whoosh Redis storage
"""
Copyright (c) 2012 Zohaib Sibte Hassan
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 copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
@maxpert
maxpert / README.md
Last active September 17, 2021 19:59
JDK 17 benchmarks

Here are some benchmarks of JDK 17 GCs. I wanted to compare a basic service running on Vert.x fetching and stream (HTTP chuncked transfer) 500 rows, serializing them to JSON (almost 30KB when serialized), send them over wire (buffered). Here are tech specs of this benchmarks:

  • All processes including Vegeta, Postgres, and Java were running on same machine
  • Host machine is a 2015 Macbook Pro (2.2 GHz Quadcore Intel Core i7), with 16 GB 1600 MHZ DDR3 RAM.
  • Each benchmark was warmed up by first running atleast 3 1000 req/s stress tests before the readings posted in these benchmarks.
  • RSS of each process was noted towards the end of benchmarks.
@maxpert
maxpert / License.md
Last active October 16, 2022 22:32
Marmot Scripts

MIT License

Copyright (c) 2022 Zohaib Sibte Hassan

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:

@maxpert
maxpert / README.md
Created December 7, 2022 03:33
Redis Toolbelt

Set of Deno scripts with some powerful toolbelt scripts for Redis

MIT License

Copyright (c) 2022 Zohaib Sibte Hassan

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

@maxpert
maxpert / DumpIndexWriter.java
Created October 8, 2012 16:59
Lucene redis example
package mxp;
import java.io.IOException;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.NumericField;
import org.apache.lucene.index.CorruptIndexException;
@maxpert
maxpert / CoroutineDebouncer.kt
Created August 1, 2018 05:29
Kotlin Coroutine Debouncer
class CoroutineDebouncer<K, V> constructor(
private val pendingBoard: ConcurrentMap<K, Deferred<V?>>
) {
/**
* Debounce given a `task` based upon given `id`. This prevents jobs with same IDs run in parallel.
* For subsequent callers get Deferred<V> of first (winning) coroutine.
* Once Deferred<V> completes it is remove from the board.
*
* @param id for uniquely identifying a task
* @param context under which given coroutine will be executed
@maxpert
maxpert / .dockerignore
Last active January 22, 2024 14:01
Marmot + PocketBase + Fly.io
/.git