... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
function directionalFocus(selector) | |
local current = hs.window.focusedWindow() | |
local currentFrame = current:frame() | |
local others = hs.window.orderedWindows() | |
for i, win in pairs(others) do | |
local otherFrame = win:frame() | |
local intersect = otherFrame:intersect(currentFrame) | |
if intersect.area == 0 and selector(currentFrame, otherFrame, intersect) then | |
win:focus() | |
break |
class IOLogger < IO | |
@@log_index = 0 | |
def initialize(@io : IO) | |
@@log_index += 1 | |
@log = File.new("log#{@@log_index}.txt", "w") | |
@mode = :waiting | |
end | |
def read(slice : Bytes) |
version: '2' | |
volumes: | |
cattle: | |
mysql-log: | |
nginx-certs: | |
nginx-dhparam: | |
nginx-vhost: | |
nginx-html: | |
services: |
... or Why Pipelining Is Not That Easy
Golang Concurrency Patterns for brave and smart.
By @kachayev
I hereby claim:
To claim this, I am signing this object:
macro embed_ecr(filename, io_name) | |
\{{ run("ecr/process", {{filename}}, {{io_name}}) }} | |
end | |
macro ecr_file(filename) | |
def to_s(__io__, section = nil) | |
embed_ecr {{filename}}, "__io__" | |
end | |
def to_s(__io__, &block) |
#!/bin/sh | |
MYSQL="mysql -u root nuntium -s -N -e" | |
LASTID=`$MYSQL 'SELECT max(id) from logs'` | |
while true; do | |
$MYSQL "SELECT * FROM logs WHERE id > $LASTID" | |
LASTID=`$MYSQL 'SELECT max(id) from logs'` | |
sleep 1 | |
done |
require "json" | |
class Request | |
property timestamp | |
property method | |
property path | |
property ip | |
property pid | |
property controller | |
property action |
require "net/ssl" | |
require "net/http" | |
server = HTTP::Server.new(8443) do |request| | |
# request.to_io(STDOUT) | |
# puts | |
HTTP::Response.not_found | |
end | |
server.ssl = SSLContext.new.tap do |ssl_ctx| |
#include <gc/gc.h> | |
#include <pcl.h> | |
#include <stdio.h> | |
void coroutine(void *arg) | |
{ | |
int i; | |
for (i = 0; i < 1000; ++i) | |
{ | |
printf("%d\n", i); |