Skip to content

Instantly share code, notes, and snippets.

View cloudhead's full-sized avatar
🌴
On vacation

Alexis Sellier cloudhead

🌴
On vacation
View GitHub Profile
use std::io;
use std::net;
use std::os::unix::io::AsRawFd;
use std::os::unix::io::RawFd;
use std::time;
#[repr(C, packed)]
pub struct Descriptor {
fd: RawFd,
events: libc::c_short,
### Keybase proof
I hereby claim:
* I am cloudhead on github.
* I am cloudhead (https://keybase.io/cloudhead) on keybase.
* I have a public key whose fingerprint is 9453 A236 6051 325A 9983 4A19 0F08 5776 FC21 7A78
To claim this, I am signing this object:
package main
type Error struct {
Err error
}
func (e *Error) Error() string {
return e.Err.Error()
}
newtype Inventory = Inventory (IntMap (Maybe Item))
nextFreeSlot :: Inventory -> Maybe IntMap.Key
nextFreeSlot (Inventory inv) =
go $ IntMap.toAscList inv
where
go ((k, Nothing) : _) = Just k
go [] = Nothing
go (_ : xs) = go xs
@cloudhead
cloudhead / bqueue.go
Created August 7, 2013 12:43
Blocking queue implementation
package queue
import "sync"
type Message string
type Queue struct {
wmu sync.Mutex
cmu sync.Mutex
slice []*Message
@cloudhead
cloudhead / gist:5885445
Created June 28, 2013 15:15
cloudhead's ASCII Emoticons
# cloudhead's ASCII Emoticon reference
T,T Q,Q T_T # Crying face
^,^ ^_^ # Happy face
<,< <_< # Uncertain or hesitant face
V,V V_V # Tired uncertain face, also "Sighing" face
*,* *_* # Exhausted face/Too much computer face
@,@ @_@ # Hangover face
o,o O,O # Surprised face
^.^ # Happy dog face
#!/bin/sh
set -xeo pipefail
eval $1 | eval $2
package main
func main() {
println("starting..")
go func() {
println("hello") // This never prints
}()
for {}

Variadic argument support in LESS 1.3.0

.mixin (...) {        // matches 0-N arguments
.mixin () {           // matches exactly 0 arguments
.mixin (@a: 1) {      // matches 0-1 arguments
.mixin (@a: 1, ...) { // matches 0-N arguments
.mixin (@a, ...) {    // matches 1-N arguments
@cloudhead
cloudhead / gist:1677036
Created January 25, 2012 16:17
Go in < 140 characters

Go in < 140 characters

if err != nil {
    return
}