Skip to content

Instantly share code, notes, and snippets.

@jkreps
jkreps / benchmark-commands.txt
Last active January 21, 2024 11:02
Kafka Benchmark Commands
Producer
Setup
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test-rep-one --partitions 6 --replication-factor 1
bin/kafka-topics.sh --zookeeper esv4-hcl197.grid.linkedin.com:2181 --create --topic test --partitions 6 --replication-factor 3
Single thread, no replication
bin/kafka-run-class.sh org.apache.kafka.clients.tools.ProducerPerformance test7 50000000 100 -1 acks=1 bootstrap.servers=esv4-hcl198.grid.linkedin.com:9092 buffer.memory=67108864 batch.size=8196
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@simeonf
simeonf / pex.md
Last active January 9, 2024 05:11
Creating a PEX from a python script

So you want to create a pex that packages your script and its dependencies?

Ok - first to make our script! Call it foo.py:

import requests

if __name__ == '__main__':
  req = requests.get("https://raw.githubusercontent.com/pantsbuild/pex/master/README.rst")
  print req.text.split("\n")[0]
@mbostock
mbostock / .block
Last active December 17, 2023 21:17
Save SVG as PNG
license: gpl-3.0
@mgedmin
mgedmin / StartSSL.md
Last active October 22, 2023 07:52
Free StartSSL.com SSL certificate HOWTO

How to get a free StartSSL.com SSL certificate

I'm writing this up from memory, so errors may appear.

This has been updated to use SHA256 certificates.

Start

  1. Go to http://www.startssl.com/
  2. Click on 'Control Panel'
@joelittlejohn
joelittlejohn / TtlHashMap.java
Last active October 4, 2023 10:50
A passive TTL hash map, that expires and removes values if they are older than some time-to-live. I have only proved it correct, not tried it ;) [As the author of this code, I dedicate it to the public domain https://creativecommons.org/publicdomain/zero/1.0]
package com.example;
import static java.util.Collections.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.TimeUnit;
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/
@tonious
tonious / hash.c
Last active February 17, 2023 02:25
A quick hashtable implementation in c.
/* Read this comment first: https://gist.github.com/tonious/1377667#gistcomment-2277101
* 2017-12-05
*
* -- T.
*/
#define _XOPEN_SOURCE 500 /* Enable certain library functions (strdup) on linux. See feature_test_macros(7) */
#include <stdlib.h>
#include <stdio.h>
0.0.0.0
1.1.80.147
1.1.127.45
1.33.190.70
1.33.191.58
1.209.208.200
1.234.1.235
1.234.2.155
1.234.4.97
1.234.17.34
@vsajip
vsajip / mptest2.py
Created February 10, 2011 08:25
Example of multiprocessing and logging where main process uses a thread
#!/usr/bin/env python
# Copyright (C) 2011 Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permission notice appear in
# supporting documentation, and that the name of Vinay Sajip
# not be used in advertising or publicity pertaining to distribution
# of the software without specific, written prior permission.