This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func TabWriteSliceOfStructs[E any](w io.Writer, d []E) error { | |
t := reflect.TypeOf(d).Elem() | |
for i := 0; i < t.NumField(); i++ { | |
if i > 0 { | |
if _, err := w.Write([]byte{'\t'}); err != nil { | |
return err | |
} | |
} | |
if _, err := w.Write([]byte(t.Field(i).Name)); err != nil { | |
return err |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @cmd nvarchar(2000) | |
SET @cmd = N'USE [?] IF EXISTS(SELECT * FROM INFORMATION_SCHEMA.COLUMNS | |
WHERE TABLE_NAME = ''TABLE_NAME_HERE'' | |
AND COLUMN_NAME = ''COLUMN_NAME_HERE'') | |
BEGIN | |
SELECT DB_NAME() AS ''Database'', ''TRUE'' AS ''Exists'' | |
END | |
ELSE SELECT DB_NAME() AS ''Database'', ''FALSE'' AS ''Exists''' | |
EXEC sp_MSforeachdb @command1 = @cmd; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* https://stackoverflow.com/a/5146398/1088079 */ | |
SELECT | |
row_number() over(order by user_seeks,user_lookups,user_scans), | |
[Database] = d.name, | |
[Schema]= s.name, | |
[Table]= o.name, | |
[Index]= x.name, | |
[Scans] = user_scans, | |
[Seeks] = user_seeks, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener("contextmenu", async function(e) { | |
const message = e.target.closest('.chat-line__message'); | |
if (!message) { | |
return; | |
} | |
e.preventDefault(); | |
const obs = new OBSWebSocket(); | |
await obs.connect("ws://127.0.0.1:4455", "4tP1Yw7d5FxnnCjI"); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html lang="en"> | |
<head> | |
<meta charset="UTF-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | |
<title>OBS Websocket</title> | |
<script src="https://unpkg.com/obs-websocket-js"></script> | |
<script type="module" async> | |
document.addEventListener("DOMContentLoaded", async function() { | |
const obs = new OBSWebSocket(); | |
await obs.connect("ws://192.168.0.158:4455", "4tP1Yw7d5FxnnCjI"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DisposableStopwatch : Stopwatch, IDisposable | |
{ | |
public delegate string OnStopDelegate(TimeSpan time); | |
private readonly OnStopDelegate _onStop; | |
public DisposableStopwatch(OnStopDelegate onStop) | |
{ | |
_onStop = onStop; | |
Start(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package test | |
Id :: struct(T: typeid) { | |
value: int, | |
} | |
Asset :: struct { | |
id: Id(Asset), | |
name: string, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package emulator | |
import "core:os" | |
import "core:fmt" | |
import "core:time" | |
import "core:math/rand" | |
when ODIN_OS == "windows" do foreign import libc "system:libcmt.lib"; | |
when ODIN_OS == "linux" do foreign import libc "system:c"; | |
foreign libc { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copyright (c) 2020 Aleksander B. Birkeland (thebirk) | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a copy | |
// of this softwareand associated documentation files(the "Software"), to deal | |
// in the Software without restriction, including without limitation the rights | |
// to use, copy, modify, merge, publish, distribute, sublicense, and /or sell | |
// copies of the Software, and to permit persons to whom the Software is | |
// furnished to do so, subject to the following conditions : | |
// | |
// The above copyright noticeand this permission notice shall be included in all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
REM Copyright 2020 Aleksander B. Birkeland <[email protected]> | |
REM | |
REM Permission is hereby granted, free of charge, to any person obtaining a | |
REM copy of this software and associated documentation files (the "Software"), | |
REM to deal in the Software without restriction, including without limitation | |
REM the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
REM and/or sell copies of the Software, and to permit persons to whom the | |
REM Software is furnished to do so, subject to the following conditions: | |
REM |
NewerOlder