Skip to content

Instantly share code, notes, and snippets.

@cozos
cozos / memray-flamegraph-profile.worker-1-2.pid-3316.html
Created December 7, 2022 07:49
memray-flamegraph-profile.worker-1-2.pid-3316.html
This file has been truncated, but you can view the full file.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>memray - flamegraph report</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<style>/* Blocks */
@cozos
cozos / aerospike_setup.md
Last active July 26, 2020 08:11
Set up Aerospike on Docker Swarm

Set up Aerospike/docker:

Set up EC2-Instances. I used i3.4xlarge. You need the following inbound rules on the Security Group:

  • TCP 3000 - 3004 (Aerospike heartbeat, gossip etc)
  • TCP 2377 (Docker Swarm cluster management, Raft)
  • TCP/UDP 7946 (Docker Swarm control plane, gossip service discovery)
  • UDP 4789 (Docker Swarm overlay network traffic)
  • ESP (50) (Docker Swarm overlay network encryption, select "Custom Protocol" and type in 50)

See:

@cozos
cozos / sample_pub_key.txt
Created January 25, 2020 01:08
Sample Public Key
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEqsFOK/0AaVedfSQEInm5yevgH6Xv
8KNh7Njy/7gmIuNCbW8DWYbR4vL2P07SD+29jxGPLnTA0SimkWsfE1b3yA==
-----END PUBLIC KEY-----
@cozos
cozos / S3ATextInputFormat.java
Created June 6, 2019 04:55
TextInputFormat with improved S3A listing
public class S3ATextInputFormat extends TextInputFormat {
private static final PathFilter hiddenFileFilter = p -> {
String name = p.getName();
return !name.startsWith("_") && !name.startsWith(".");
};
private static class MultiPathFilter implements PathFilter {
private List<PathFilter> filters;
public MultiPathFilter(List<PathFilter> filters) {
import math
import random
rolls = [[random.randint(1,6) for i in xrange(4)] for j in xrange(6)]
# remove lowest roll
for roll in rolls:
roll.remove(min(roll))
@pytest.fixture(scope='function')
def db_session():
db_url = "postgresql://..."
engine = create_engine(db_url)
session = scoped_session(sessionmaker(bind=engine))
yield session
session.rollback()
session.close()
TextDisplay *textDisplay = new TextDisplay();
Grid *grid = new Grid(n, n);
// Create a cell for every single slot.
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
grid->setCell(i, j, new Cell());
}
}
// Set observers for every single cell.
@cozos
cozos / example.jsx
Last active November 10, 2024 19:15
import React from 'react';
var ExampleApplication = React.createClass({
render: function() {
var elapsed = Math.round(this.props.elapsed / 100);
var seconds = elapsed / 10 + (elapsed % 10 ? '' : '.0' );
var message =
'React has been successfully running for ' + seconds + ' seconds.';
return <p>{message}</p>;