Skip to content

Instantly share code, notes, and snippets.

@sbalaji6
sbalaji6 / win32.go
Created October 15, 2020 05:47 — forked from nathan-osman/win32.go
Simple Windows GUI application written in Go
package main
import (
"log"
"syscall"
"unsafe"
)
var (
kernel32 = syscall.NewLazyDLL("kernel32.dll")
@sbalaji6
sbalaji6 / powershell.go
Created October 15, 2020 05:43 — forked from coolbrg/powershell.go
Playing PowerShell command via Golang
package main
import (
"bytes"
"fmt"
"os/exec"
"strings"
)
// PowerShell struct
[string]$randNo = Get-Random
$tempFolder = $($env:temp)+"\Logs"+"-"+$randNo+"-$(Get-Date -UFormat "%m%d%Y%H%M%S")"
New-Item -Path $tempFolder -ItemType Directory
$eventLogs = "event-logs"
#Copy event logs
New-Item -Path "$($tempFolder)\$($eventLogs)" -ItemType Directory
Copy-Item -Path "$env:SystemRoot\System32\Winevt\Logs\*" -Destination "$($tempFolder)\$($eventLogs)" -Recurse
@sbalaji6
sbalaji6 / cygwin-mirror-speed.py
Created August 1, 2018 11:24 — forked from ushkinaz/cygwin-mirror-speed.py
Tests speed of http mirrors of cygwin
#!/usr/bin/env python3
"""
Tests http mirrors of cygwin
"""
import random
import time
from urllib.request import urlopen
import sys
__author__ = 'Dmitry Sidorenko'
import os
import fnmatch
def recursive_glob(rootdir='.', pattern='*'):
"""Search recursively for files matching a specified pattern.
Adapted from http://stackoverflow.com/questions/2186525/use-a-glob-to-find-files-recursively-in-python
"""
matches = []
Get-ChildItem . -Recurse -Filter "*.inf" | ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }