Skip to content

Instantly share code, notes, and snippets.

package udp_test
import (
"net"
"strconv"
"time"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
✘ ~ → go test -v runtime/pprof
=== RUN TestMemoryProfiler
--- PASS: TestMemoryProfiler (0.01s)
=== RUN TestCPUProfile
--- PASS: TestCPUProfile (5.00s)
pprof_test.go:139: uname -a: Darwin liszt.local 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64
pprof_test.go:216: total 440 CPU profile samples collected
pprof_test.go:239: runtime/pprof_test.cpuHog1: 406
=== RUN TestCPUProfileMultithreaded
--- PASS: TestCPUProfileMultithreaded (5.00s)
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
int sink;
void doSomething() {
package main
import (
"net"
_ "net/http/pprof"
)
const host = "localhost:4242"
// Opens a UDP listener and ignores any data
package main
import (
"net"
"net/http"
_ "net/http/pprof"
)
const host = "localhost:4242"
Contributor License Agreement
The following terms are used throughout this agreement:
You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
Project - is an umbrella term that refers to any and all GitHub open source projects.
Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with GitHub, contributors or maintainers.
1. Grant of Copyright License.
package bench
import (
"bytes"
"encoding/binary"
"io"
"testing"
)
func BenchmarkWriteByte(b *testing.B) {
### Keybase proof
I hereby claim:
* I am lucas-clemente on github.
* I am lclemente (https://keybase.io/lclemente) on keybase.
* I have a public key whose fingerprint is E2A4 476D E63B 0B27 B357 0F26 4273 9281 0E47 693A
To claim this, I am signing this object:
# Description:
# YO
#
# Commands:
# hubot yo <name> - YO
module.exports = (robot) ->
robot.respond /YO (\w+)$/i, (msg) ->
token = process.env.HUBOT_YO_TOKEN
data = "api_token=#{token}&username=#{msg.match[1]}"
@lucas-clemente
lucas-clemente / cron.rb
Last active August 29, 2015 14:02
Proof of concept for calculating cron job times
#!/usr/bin/env ruby
# Calculate the next match for cron conditions (secs).
# Numbers > 60 mean the match is in the next minute.
#
# Arbitrary conditions:
# just take the minimum of all the individual ones.
# 60 secs / min