Skip to content

Instantly share code, notes, and snippets.

Konstantin Khomoutov kostix

Block or report user

Report or block kostix

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View hello.go
package main
/*
#cgo CFLAGS: -Wall -O2 -fPIC
#cgo linux CFLAGS: -DLINUX=1
#cgo LDFLAGS: -Lnewplus -lnewplus -Wl,-rpath='$ORIGIN'/newplus
#include <stdlib.h>
#include "newplus/plus.h"
*/
import "C"
@kostix
kostix / ifspace.go
Created Apr 4, 2016
Getting Ethernet interface speed on Linux using Go via cgo
View ifspace.go
package main
/*
#include <stdio.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <linux/sockios.h>
#include <linux/if.h>
@kostix
kostix / netapi32.go
Created Mar 9, 2016
Wrapping Win32 API NetSessionEnum() in Go
View netapi32.go
package main
import (
"log"
"syscall"
"unicode/utf16"
"unsafe"
"time"
)
@kostix
kostix / tempfile\tempfile.go
Last active Feb 11, 2016
`tempfile` Go package mimicking mkstemp(3) and mkstemps(3) libc calls
View tempfile\tempfile.go
package tmpfile
import (
"bytes"
"errors"
"os"
"sync/atomic"
"time"
)
View impersonate.go
// A demonstration example for http://stackoverflow.com/a/26124494
// It runs a goroutine locked to an OS thread on Windows
// then impersonates that thread as another user using its name
// and plaintext password, then reverts to the default security
// context before detaching from its OS thread.
package main
import (
"log"
"runtime"
You can’t perform that action at this time.