Skip to content

Instantly share code, notes, and snippets.

View angrypie's full-sized avatar

Nikita Hrytsai angrypie

View GitHub Profile
letter = "A" … "Z" | "a" … "z" .
decimalDigit = "0" … "9" .
octalDigit = "0" … "7" .
hexDigit = "0" … "9" | "A" … "F" | "a" … "f" .
ident = letter { letter | decimalDigit | "_" } .
fullIdent = ident { "." ident } .
messageName = ident .
enumName = ident .
import "fmt"
func main() {
queue := make(chan struct {string; int})
go sendPair(queue)
pair := <-queue
fmt.Println(pair.string, pair.int)
}
func sendPair(queue chan struct {string; int}) {
@angrypie
angrypie / client.go
Created March 21, 2016 00:26
go and udp
package main
import (
"log"
"net"
)
func main() {
log.Println("Start")
addr, _ := net.ResolveUDPAddr("udp4", "localhost:8080")
@angrypie
angrypie / udp_client.go
Created March 20, 2016 21:40 — forked from reterVision/udp_client.go
A dummy UDP hole punching sample in Go
package main
import (
"encoding/json"
"fmt"
"log"
"net"
"os"
"time"
)
let correctBrackets = (str) => {
let allowedSymbols = {
'[': 1, '{': 1, '<': 1, '(': 1, ']': 1, '}': 1, '>': 1, ')': 1
}
let brackets = { '[': ']', '{': '}', '<': '>', '(': ')' }
let count = 0, ob = [], result = [];
for(let c of str) {
if(!allowedSymbols[c]) return null;