Skip to content

Instantly share code, notes, and snippets.

@dantheman213
dantheman213 / readme.txt
Created March 22, 2020 23:54
recommended video settings for best streaming
1080p and below
Container = MP4
Video = h.264
Audio = AC3 / ACC
4K
Container = MP4
Video = h.265
Audio AC3
@dantheman213
dantheman213 / hyperv_on.ps1
Created March 14, 2020 06:08
Enable Hyper-V on Windows 10
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@dantheman213
dantheman213 / hyperv_on.ps1
Created March 14, 2020 06:08
Enable Hyper-V on Windows 10
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
@dantheman213
dantheman213 / GetPrimaryNetworkAdapters.cs
Last active January 13, 2024 10:15
Get primary network adapter(s) info for C#
using System;
using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
namespace GetPrimaryNetworkDeviceInfoExample
{
public class Program
{
public static void Main()

How To List Local Network Devices Cross Platform

Windows

arp -a

Get Wifi Info

Commands needed to get similar information cross-platform.

Windows Command Prompt

netsh wlan show networks mode=bssid
# hyper-v on/off in windows 10
bcdedit /set hypervisorlaunchtype off
bcdedit /set hypervisorlaunchtype on
dism.exe /Online /Disable-Feature:Microsoft-Hyper-V
// https://www.reddit.com/r/golang/comments/1hvvnn/any_better_way_to_do_a_crossplatform_exec_and/
func GetCommandResult(cmd *exec.Cmd) ([]byte, int, error) {
output, err := cmd.CombinedOutput()
if err != nil {
if e2, ok := err.(*exec.ExitError); ok {
if status, ok := e2.Sys().(syscall.WaitStatus); ok && runtime.GOOS == "windows" {
s := reflect.ValueOf(&status).Elem()
for i := 0; i < s.NumField(); i++ {
if s.Type().Field(i).Name == "ExitCode" {
@dantheman213
dantheman213 / aws-cw-query-all-log-groups.md
Last active March 2, 2020 01:39
AWS CloudWatch Query Every Log Group Beyond AWS UI Maximum

Get all log groups

aws2 logs describe-log-groups --page-size 50 --max-items 1000 --profile preprod | jq -r '.logGroups[].logGroupName'

---

Query every log group in the last 30 mins

aws2 logs describe-log-groups --page-size 50 --max-items 1000 --profile preprod | jq -r '.logGroups[].logGroupName' | while read line; do echo $line; aws2 logs start-query --profile preprod --log-group-name $line --query-string 'filter @message like /(?i)(mongoerror|staging1)/| fields @timestamp, @message | sort @timestamp desc' --start-time $(expr 1578699670 - 1800) --end-time 1578699670 | jq -r '.queryId' >> queryIds.txt; echo $line >> link.txt; tail -1 queryIds.txt >> link.txt; done

Get results from every query ID generated in previous command

cat queryIds.txt | while read line; do echo $line; echo $line >> results.txt ; aws2 logs get-query-results --profile preprod --query-id $line >> results.txt; done

package main
import "fmt"
func main() {
fmt.Println("Welcome to B-Tree test")
btree := makeBTree()
fmt.Println("In-order b-tree traversal")
traverse(&btree)
fmt.Println("Exit B-Tree test")