Skip to content

Instantly share code, notes, and snippets.

View dmitshur's full-sized avatar

Dmitri Shuralyov dmitshur

View GitHub Profile
@kylelemons
kylelemons / piping.go
Last active July 4, 2022 01:25 — forked from dagoof/piping.go
piping exec.Cmd in golang (example sorts all regular files under a directory by their extension)
package main
import (
"bytes"
"exec"
"log"
"os"
)
// Pipeline strings together the given exec.Cmd commands in a similar fashion
@jboner
jboner / latency.txt
Last active May 23, 2024 06:51
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@mandel59
mandel59 / hello.go
Created October 14, 2012 07:31
Golang OpenGL Shader Example
// -*- coding: utf-8 -*-
// 参考: 床井研究室 - (4) シェーダの追加
// http://marina.sys.wakayama-u.ac.jp/~tokoi/?date=20120909
package main
import (
gl "github.com/chsc/gogl/gl33"
"github.com/jteeuwen/glfw"
"log"
"unsafe"
@schacon
schacon / git-http-proto.txt
Created July 26, 2013 22:16
Git HTTP transport protocol documentation
HTTP transfer protocols
=======================
Git supports two HTTP based transfer protocols. A "dumb" protocol
which requires only a standard HTTP server on the server end of the
connection, and a "smart" protocol which requires a Git aware CGI
(or server module). This document describes both protocols.
As a design feature smart clients can automatically upgrade "dumb"
protocol URLs to smart URLs. This permits all users to have the
@kjk
kjk / show_caller_name.go
Last active December 31, 2015 19:39
Shows that we can get the caller's function name without access to source code. go build -o test show_caller_name.go; rm show_caller_name.go; ./test
package main
import (
"bytes"
"fmt"
"runtime"
)
var (
dunno = []byte("???")
@DisposaBoy
DisposaBoy / openclipboard.py
Created January 22, 2014 08:26
a sublime text plugin example to open the file path that's in the clipboard
# this plugin creates a command `open_from_clipboard` that opens the path that's currently in the clipboard
# save this file at Packages/User/openclipboard.py
# then add the follow key binding if you like via the menu Preferences > Key Bindings - User
# { "keys": ["ctrl+shift+o"], "command": "open_from_clipboard" }
import sublime
import sublime_plugin
class OpenFromClipboardCommand(sublime_plugin.WindowCommand):
def run(self):
@wancw
wancw / y-combinator.go
Last active September 19, 2023 20:22
Y combinator in Go, runable example: http://play.golang.org/p/xVHw0zoaWX
package main
import "fmt"
type (
tF func(int) int
tRF func(tF) tF
tX func(tX) tF
)
@mholt
mholt / everything.go
Last active April 14, 2020 13:53
Implements 103 of the 114 Go 1.3 standard library interfaces
package interfaces
import (
"bufio"
"crypto/elliptic"
"crypto/tls"
"database/sql/driver"
"debug/dwarf"
"encoding/xml"
"fmt"
@jpillora
jpillora / sshd.go
Last active December 17, 2023 16:27
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:

Experimental Generation of Interpersonal Closeness

Instructions to Subjects Included With Task Slips Packet

This is a study of interpersonal closeness, and your task, which we think will be quite enjoyable, is simply to get close to your partner. We believe that the best way for you to get close to your partner is for you to share with them and for them to share with you. Of course, when we advise you about getting close to your partner, we are giving advice regarding your behavior in this demonstration only, we are not advising you about your behavior outside of this demonstration.

In order to help you get close we've arranged for the two of you to engage in a kind of sharing game. You're sharing time will be for about one hour, after which time we ask you to fill out a questionnaire concerning your experience of getting close to your partner.

You have been given three sets of slips. Each slip has a question or a task written on it. As soon as you both finish reading these instructions, you should