Skip to content

Instantly share code, notes, and snippets.

View kostix's full-sized avatar

Konstantin Khomoutov kostix

  • TradingView
  • Saint-Petersburg, Russia
View GitHub Profile
@kostix
kostix / Makefile
Last active October 29, 2022 10:40
Writing C string to a C-allocated buffer from Go
CC = /usr/bin/i686-w64-mingw32-gcc
GOOS = windows
GOARCH = 386
CGO_ENABLED = 1
export CC GOOS GOARCH CGO_ENABLED
.PHONY: all build run clean
all: run
@kostix
kostix / get-fixed-volume-mounts.go
Created July 9, 2020 19:51
Getting the list of fixed volumes and their mounts
package main
import (
"errors"
"log"
"strings"
"syscall"
"unsafe"
)
@kostix
kostix / find_first_file.c
Last active September 5, 2023 09:16
FindFirstFile/FindNextFile
#include <stdlib.h>
#include <stdio.h>
#include <locale.h>
#define WIN32_LEAN_AND_MEAN
#define _UNICODE
#include <windows.h>
int print_sys_error(DWORD last_error)
{
@kostix
kostix / impersonate.go
Created September 30, 2014 16:46
A demonstration example for http://stackoverflow.com/a/26124494
// 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"