Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# Copyright (c) <2018> <Maksym Rusynyk>
#
# 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:
#
@matsuu
matsuu / slow_query.sql
Last active November 23, 2023 13:07
performance_schemaを使用したスロークエリー抽出
-- ORDER BYとLIMITは必要応じて適宜修正
-- VIEWを作成すると便利
SELECT
count_star AS cnt,
sum_timer_wait/1e12 AS sum,
min_timer_wait/1e12 AS min,
avg_timer_wait/1e12 AS avg,
max_timer_wait/1e12 AS max,
sum_rows_sent AS sumRows,
sum_rows_sent/count_star AS avgRows,
@filipefigcorreia
filipefigcorreia / kafka-cheat-sheet.md
Last active February 8, 2023 09:29
Apache Kafka Cheat Sheet

Kafka Topics

List existing topics

bin/kafka-topics.sh --zookeeper localhost:2181 --list

Purge a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --config retention.ms=1000

... wait a minute ...

bin/kafka-topics.sh --zookeeper localhost:2181 --alter --topic mytopic --delete-config retention.ms

@zchee
zchee / actionlist.vim
Last active July 30, 2024 14:35
IdeaVim actionlist
--- Actions ---
$Copy <M-C>
$Cut <M-X> <S-Del>
$Delete <Del> <BS> <M-BS>
$LRU
$Paste <M-V>
$Redo <M-S-Z> <A-S-BS>
$SearchWeb <A-S-G>
$SelectAll <M-A>
$Undo <M-Z>
@notxcain
notxcain / FormatCompanion.scala
Last active January 15, 2019 13:34
play.api.libs.json.Format[A] automatic derivation using LabelledTypeClass from shapeless
/*
* Copyright (c) 2014-15 Denis Mikhaylov
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@runarorama
runarorama / gist:a8fab38e473fafa0921d
Last active April 13, 2021 22:28
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]