Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am cyx on github.
  • I am cyx (https://keybase.io/cyx) on keybase.
  • I have a public key whose fingerprint is 01E2 5AEB FB21 F347 663C AF1C 11A4 021D 590C 7354

To claim this, I am signing this object:

@cyx
cyx / core.go
Created November 7, 2015 02:28 — forked from apg/core.go
package main
import (
"fmt"
"sync"
)
type Event map[string]interface{}
type asyncStreamFunc func(done <-chan struct{}, in <-chan Event, out chan<- Event)

Generated private key

openssl genrsa -out server.key 2048

To generate a certificate

openssl req -new -x509 -key server.key -out server.pem -days 3650

https

@cyx
cyx / sse.go
Last active August 29, 2015 14:15 — forked from ismasan/sse.go
package main
import (
"fmt"
"log"
"net/http"
"time"
)
// Example SSE server in Golang.
// github.com/nu7hatch/gouuid
BenchmarkV4 1000000 1426 ns/op
BenchmarkV5 2000000 910 ns/op
// github.com/streadway/simpleuuid
BenchmarkV5 5000000 689 ns/op
// github.com/tux21b/gocql/tree/master/uuid
BenchmarkRandomUUID 1000000 1470 ns/op
var h = require('mercury').h;
var css = require('./index.css');
var insert = require('insert-css');
module.exports = function component(state) {
insert(css);
return h('.foo')
}
var randomNumbers = [42, 12, 88, 62, 63, 56, 1, 77, 88, 97, 97, 20, 45, 91, 62, 2, 15, 31, 59, 5]
func partition(v: Int[], left: Int, right: Int) -> Int {
var i = left
for j in (left + 1)..(right + 1) {
if v[j] < v[left] {
i += 1
(v[i], v[j]) = (v[j], v[i])
}
}
class Frontend < Cuba
use Rack::Protection
end
class API < Cuba
end
class App < Cuba
on "api" do

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@cyx
cyx / lua+uwsgi.sh
Created April 18, 2014 23:31
Install uwsgi with lua support
#!/bin/bash
# The MIT License (MIT)
#
# Copyright (c) 2014 Cyril David <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell