Skip to content

Instantly share code, notes, and snippets.

@chetan
chetan / yardoc_cheatsheet.md
Last active April 16, 2024 23:49
YARD cheatsheet
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

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 July 8, 2012 14:41
d3.js: force layout; click to group/bundle nodes
# Editor backup files
*.bak
*~
@cyberdelia
cyberdelia / Consumer.kt
Created October 21, 2020 23:29
Kafka + Kotlin + Coroutines
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>> =
@leifg
leifg / Vagrantfile
Last active November 12, 2023 08:31
Add a second disk to system using vagrant
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
@johnllao
johnllao / HelloProto.java
Created November 5, 2015 04:25
Protobuf Descriptor and Dynamic Messages
package org.hello.protobuf;
import java.util.Map;
import com.google.protobuf.*;
import com.google.protobuf.Descriptors.*;
import com.google.protobuf.DescriptorProtos.*;
public class HelloProto {
@lrytz
lrytz / z-automator.png
Last active February 4, 2023 21:20
Shortcut for Syntax Highlighting in Keynote
@garybernhardt
garybernhardt / selectable_queue.rb
Last active November 23, 2022 12:42
A queue that you can pass to IO.select.
# 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:
@brendanzab
brendanzab / reactive_systems_bibliography.md
Last active October 10, 2022 06:36
A reading list that I'm collecting while building my Rust ES+CQRS framework: https://github.com/brendanzab/chronicle

Functional, Reactive, and Distributed Systems Bibliography

Books

@bryanstearns
bryanstearns / gist:4331076
Created December 18, 2012 19:23
I put this in my basebox postinstall scripts to help NTP deal with large time differences
# 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