Skip to content

Instantly share code, notes, and snippets.

View edrzmr's full-sized avatar
🏠
Working from home

Eder Ruiz edrzmr

🏠
Working from home
View GitHub Profile
@jmatsushita
jmatsushita / README
Last active September 21, 2024 01:47
Setup nix, nix-darwin and home-manager from scratch on an M1 Macbook Pro
###
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places.
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of
###. things to watch out for:
### - Check out the `nix-darwin` instructions, as they have changed.
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026
###
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs).
# So here's a minimal Gist which worked for me as an install on a new M1 Pro.
@davegurnell
davegurnell / config.yml
Last active April 5, 2020 01:18
Minimal CircleCI 2.0 Scala build configuration with caching of Ivy/Maven dependencies
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
steps:
- checkout
- restore_cache:
key: scala-library-dependencies-{{ checksum "build.sbt" }}
- run: sbt test:compile
@clarksun
clarksun / kafka_topic_msg_count.sh
Created October 9, 2017 06:36
get kafka topic message count
kafka-run-class kafka.tools.GetOffsetShell --broker-list localhost:9092 --topic xxx --time -1 --offsets 1 | awk -F ':' '{sum += $3} END {print sum}'
@ansemjo
ansemjo / ssh-auth-sock.service
Last active August 8, 2024 22:43 — forked from xenithorb/ssh-auth-sock.service
systemd user unit to set SSH_AUTH_SOCK variable for X11/Wayland/GNOME and make it work with GnuPG agent
# Place this file in ~/.config/systemd/user/ssh-auth-sock.service
# $ systemctl --user daemon-reload
# $ systemctl --user enable --now ssh-auth-sock.service
# Add 'echo UPDATESTARTUPTTY | gpg-connect-agent >/dev/null' in your ~/.bashrc.
# Logout or reboot.
[Unit]
Description=Set SSH_AUTH_SOCK to GnuPG agent
[Service]
@johanandren
johanandren / RequestId.scala
Created September 6, 2016 07:17
Example showing how to ensure a unique id for each request, and how to log that from the Akka HTTP server DSL
import java.util.UUID
import akka.actor.ActorSystem
import akka.http.scaladsl.Http
import akka.http.scaladsl.model.HttpRequest
import akka.http.scaladsl.model.headers.{ModeledCustomHeader, ModeledCustomHeaderCompanion}
import akka.stream.ActorMaterializer
import akka.http.scaladsl.server._
import scala.io.StdIn
@ursuad
ursuad / kafka-cheat-sheet.md
Last active July 24, 2024 09:43
Quick command reference for Apache Kafka

Kafka Topics

List existing topics

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

Describe a topic

bin/kafka-topics.sh --zookeeper localhost:2181 --describe --topic mytopic

Purge a topic

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

... wait a minute ...

@OlegIlyenko
OlegIlyenko / CustomJsonScalarType.scala
Last active March 4, 2022 16:48
An example of custom raw JSON scalar type in sangria. DON'T USE IT! By using it you lose many benefits of GraphQL. This just demonstrates that it is possible. If you tempted to expose it, then definitely think twice before using it.
import sangria.ast
import sangria.execution.Executor
import sangria.marshalling.{InputUnmarshaller, ScalarValueInfo, ArrayMapBuilder, ResultMarshaller}
import sangria.schema._
import sangria.validation.{ValueCoercionViolation, IntCoercionViolation, BigIntCoercionViolation}
import spray.json._
import sangria.macros._
import scala.concurrent.ExecutionContext.Implicits.global
implicit object CustomSprayJsonResultMarshaller extends ResultMarshaller {
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
# core
brew install coreutils
# key commands
brew install binutils
brew install diffutils
brew install ed --default-names
brew install findutils --with-default-names
@raphink
raphink / Dockerfile
Last active February 11, 2019 22:38
C2C blog post: Flexible Docker entrypoints scripts
COPY /docker-entrypoint.sh /
COPY /docker-entrypoint.d/* /docker-entrypoint.d/
ONBUILD COPY /docker-entrypoint.d/* /docker-entrypoint.d/
ENTRYPOINT ["/docker-entrypoint.sh", "/opt/puppetlabs/puppet/bin/mcollectived"]
CMD ["--no-daemonize"]
@epcim
epcim / brew_install_coreutils.sh
Created November 13, 2015 10:47
OSX brew install GNU coreutils, bin utils etc...
# From https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/
export PATH="$(brew --prefix coreutils)/libexec/gnubin:/usr/local/bin:$PATH"
brew install coreutils
brew install gnu-tar --with-default-names
# alternatively
brew install binutils
brew install diffutils