Skip to content

Instantly share code, notes, and snippets.

View erikdubbelboer's full-sized avatar

Erik Dubbelboer erikdubbelboer

View GitHub Profile
@erikdubbelboer
erikdubbelboer / go.txt
Created October 11, 2019 09:31
libdill vs go concurrency
$ GOMAXPROCS=1 go run test.go
400: 200.371937ms (1285)
400: 200.557002ms (1998)
400: 201.016092ms (1993)
400: 201.548925ms (1993)
800: 201.371267ms (2340)
800: 201.489716ms (3996)
800: 205.647786ms (3998)
800: 212.762004ms (3459)
832: 223.881178ms (4000)
CREATE TABLE test (timestamp DateTime, i UInt8) Engine=MergeTree() PARTITION BY toYYYYMM(timestamp) ORDER BY (i);
INSERT INTO test values ('2020-05-13 16:38:45', 1);
SELECT
toTimeZone(timestamp, 'America/Sao_Paulo') AS converted,
timestamp AS original
FROM test
LEFT JOIN (SELECT 2 AS x) AS anything ON x = i
WHERE timestamp >= toDateTime('2020-05-13T00:00:00', 'America/Sao_Paulo');
// +build ignore
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io/ioutil"
"net/http"
package main
import (
"bytes"
"compress/gzip"
"fmt"
"io/ioutil"
"net/http"
"testing"
package main
import (
"fmt"
"net/http"
)
// This code can be found at: https://git.io/JvuTw
func main() {
const App = () => {
const [value, setValue] = useState(// ...get initial value here
const onChange = event => setValue(event.target.value);
useEffect(// ...update localStorage here
return (
<div>
<input value={value} type='text' onChange={onChange} />
<p>{value}</p>
class App extends React.Component {
state = {
value: localStorage.getItem('info') || ''
};
componentDidUpdate() {
localStorage.setItem('info', this.state.value);
}
onChange = event => {
package main
import (
"fmt"
"net"
"sync/atomic"
"time"
)
var (
@erikdubbelboer
erikdubbelboer / regressiontest.go
Last active January 1, 2020 12:09
net: 1.14 performance regression on mac: https://github.com/golang/go/issues/36298
package main
import (
"fmt"
"net"
"sync/atomic"
"time"
)
var (