This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example program showing that signal delivery from setitimer ends up in | |
// "random" threads of the executing program. | |
#include <sys/time.h> | |
#include <unistd.h> | |
#include <signal.h> | |
#include <pthread.h> | |
#include <stdio.h> | |
#include <stdlib.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Package multiwrap implements support for wrapping multiple errors into a | |
// single error value that supports the Go 1.13 Unwrap(), Is() and As() | |
// interface. It's similar to go-multierror [1]. | |
// | |
// This is a proof of concept and I'm looking for feedback! Maybe somebody has | |
// already done a nicer version of this idea? | |
// | |
// [1] https://godoc.org/github.com/hashicorp/go-multierror | |
package multiwrap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global main | |
extern printf | |
section .text | |
main: | |
sub rdi, 1 ; argc includes program name, so substract 1 to get arg count | |
cmp rdi, 1 ; check if we got exactly 1 arg | |
jne bad_arg_count ; if not, jump to bad_arg_count | |
mov r15, [rsi+8] ; main's argv[1] | |
mov r14, 0 ; index (also byte count) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let last = new Date(); | |
setInterval(function () { | |
delta = new Date() - last; | |
if (delta > 2) { | |
console.log(delta); | |
} | |
last = new Date(); | |
}, 1); | |
setInterval(function () { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time wc test.txt | |
16500000 49252094 2059004431 test.txt | |
real 0m5.930s | |
user 0m5.491s | |
sys 0m0.374s | |
$ go build wc.go && time ./wc test.txt | |
16500000 49252094 2059004431 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Nested Loop", | |
"Parallel Aware": false, | |
"Join Type": "Inner", | |
"Startup Cost": 0.01, | |
"Total Cost": 17402710335540.01, | |
"Plan Rows": 1000000000000000, | |
"Plan Width": 20, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Nested Loop", | |
"Parallel Aware": false, | |
"Join Type": "Inner", | |
"Startup Cost": 0.01, | |
"Total Cost": 12522520.01, | |
"Plan Rows": 1000000000, | |
"Plan Width": 12, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Seq Scan", | |
"Parallel Aware": false, | |
"Relation Name": "congrats_on_loading_your_first_gist", | |
"Alias": "congrats_on_loading_your_first_gist", | |
"Startup Cost": 0.00, | |
"Total Cost": 35.50, | |
"Plan Rows": 2550, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Seq Scan", | |
"Parallel Aware": false, | |
"Relation Name": "congrats_on_loading_your_first_gist", | |
"Alias": "congrats_on_loading_your_first_gist", | |
"Startup Cost": 0.00, | |
"Total Cost": 35.50, | |
"Plan Rows": 2550, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"Plan": { | |
"Node Type": "Nested Loop", | |
"Parallel Aware": false, | |
"Join Type": "Inner", | |
"Startup Cost": 0.01, | |
"Total Cost": 20010.01, | |
"Plan Rows": 1000000, | |
"Plan Width": 8, |