Skip to content

Instantly share code, notes, and snippets.

View owenthereal's full-sized avatar
🚀
Hacking

Owen Ou owenthereal

🚀
Hacking
View GitHub Profile
@owenthereal
owenthereal / main.go
Created January 23, 2021 04:45 — forked from walm/main.go
Simple Golang DNS Server
package main
import (
"fmt"
"log"
"strconv"
"github.com/miekg/dns"
)
@owenthereal
owenthereal / reader.go
Created November 1, 2019 20:41 — forked from jmackie/reader.go
Pass a single io.Reader to multiple goroutines
/*
Package fan is a little concurrent io experiment.
Example Use Case
----------------
You have a function that takes a single io.Reader as an argument. You would like
to pass that reader to several processing functions. You could just make the
function accept an io.ReadSeeker, invoke each function serially in a for loop,
seeking after each call. But that's not cool.
@owenthereal
owenthereal / atlanta.md
Created January 5, 2018 00:06 — forked from wfarr/atlanta.md
A list of things to do in Atlanta

Restaurants

Krog Street Market - Variety - $-$$$

Located in Inman Park, right on the Beltline, Krog Street Market offers a decent variety of food options, including Nashville-style hot chicken, dumplings, Tex-Mex, pizza, and more. Prices vary by restaurant.

Ponce City Market - Variety - $-$$$

In Midtown / Poncey Highlands area, right on the Beltline, Ponce City Market has a number of restaurant options available open for breakfast, lunch, and dinner. Formerly a city hall record storage facility, and before that a Sears warehouse, it's now a mixed-use development with restaurants, bars, shops, and housing.

require 'pusher-client'
socket = PusherClient::Socket.new('5df8ac576dcccf4fd076')
socket.subscribe('common')
handler = lambda do |event, data|
p [event, data]
end
events = ['job:created', 'job:started', 'job:finished', 'job:canceled',
@owenthereal
owenthereal / DisruptorTest.java
Created August 9, 2012 18:53 — forked from jbrisbin/DisruptorTest.java
Disruptor RingBuffer-based simplistic NIO HTTP test server
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.StandardSocketOptions;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.ServerSocketChannel;
@owenthereal
owenthereal / sudoers
Created September 30, 2011 23:52
CMND Alias for Ngninx
Cmnd_Alias DEVSERVER = /opt/nginx/sbin/nginx, /bin/kill
mdesrosiers ALL = NOPASSWD: DEVSERVER
# Author: Pieter Noordhuis
# Description: Simple demo to showcase Redis PubSub with EventMachine
#
# Update 7 Oct 2010:
# - This example does *not* appear to work with Chrome >=6.0. Apparently,
# the WebSocket protocol implementation in the cramp gem does not work
# well with Chrome's (newer) WebSocket implementation.
#
# Requirements:
# - rubygems: eventmachine, thin, cramp, sinatra, yajl-ruby
if ( $controllerHasModel ) {
$model = property_exists($c->{$controllerModel}, $modelName) ? $c->{$controllerModel}->{$modelName} : $c->{$modelName};
if (get_class($model) == 'AppModel') {
if (!class_exists($modelName)) {
App::import('Model', $modelName);
}
if (!class_exists($modelName)) {
return false;
}
$model = new $modelName();