Skip to content

Instantly share code, notes, and snippets.

@cyberdelia
cyberdelia / Consumer.kt
Created Oct 21, 2020
Kafka + Kotlin + Coroutines
View Consumer.kt
package com.lapanthere.bohemia
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flow
import org.apache.kafka.clients.consumer.ConsumerRecord
import org.apache.kafka.clients.consumer.KafkaConsumer
import java.time.Duration
fun <K, V> KafkaConsumer<K, V>.asFlow(timeout: Duration = Duration.ofMillis(500)): Flow<ConsumerRecord<K, V>> =
@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active Mar 28, 2022
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle
View reactive_systems_bibliography.md

Functional, Reactive, and Distributed Systems Bibliography

Books

@garthk
garthk / profile
Created Jun 21, 2015
boot2docker 1.7.0 cert fix
View profile
wait4eth1() {
CNT=0
until ip a show eth1 | grep -q UP
do
[ $((CNT++)) -gt 60 ] && break || sleep 1
done
sleep 1
}
wait4eth1
@lrytz
lrytz / z-automator.png
Last active Mar 4, 2022
Shortcut for Syntax Highlighting in Keynote
View z-automator.png
@parndt
parndt / pre-commit
Last active Dec 16, 2015 — forked from ideasasylum/pre-commit
Place this in ~/.git_template/hooks/pre-commit and chmod to 755. Now, ensure you have git >= 1.7.1 and run: git config --global init.templatedir '~/.git_template' Back in your repository, run git init again and the hook will appear.
View pre-commit
#!/usr/bin/env ruby
spec_hits = []
checks = {
'_spec\.rb$' => ['focus:[:space:]*true'],
'\.rb$' => ['binding\.pry', 'debugger']
}
# Find the names of all the filenames that have been (A)dded (C)opied or (M)odified
filenames = `git diff --cached --name-only --diff-filter=ACM`.split("\n")
@leifg
leifg / Vagrantfile
Last active Feb 4, 2022
Add a second disk to system using vagrant
View Vagrantfile
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
@bryanstearns
bryanstearns / gist:4331076
Created Dec 18, 2012
I put this in my basebox postinstall scripts to help NTP deal with large time differences
View gist:4331076
# Make sure ntpd doesn't give up if the time is way off
cp /etc/ntp.conf /etc/ntp.conf.old
(echo tinker panic 0; cat /etc/ntp.conf.old) >/etc/ntp.conf
/etc/init.d/ntp restart
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@GerHobbelt
GerHobbelt / .gitignore
Created Jul 8, 2012
d3.js: force layout; click to group/bundle nodes
View .gitignore
# Editor backup files
*.bak
*~
@garybernhardt
garybernhardt / selectable_queue.rb
Last active Jan 22, 2022
A queue that you can pass to IO.select.
View selectable_queue.rb
# A queue that you can pass to IO.select.
#
# NOT THREAD SAFE: Only one thread should write; only one thread should read.
#
# Purpose:
# Allow easy integration of data-producing threads into event loops. The
# queue will be readable from select's perspective as long as there are
# objects in the queue.
#
# Implementation: