Skip to content

Instantly share code, notes, and snippets.

@tommyready
tommyready / NetworkAdaptersUtility.cs
Last active April 18, 2024 15:01
Using C# to Disable and Enable a Network Adapter
using System;
using System.Diagnostics;
using System.Threading.Tasks;
namespace NetworkAdaptersUtility
{
class Program
{
static void Main(string[] args)
{
@migasj
migasj / WindowsSystemErrorCodes.cs
Last active May 20, 2024 21:53
Windows System Error Codes enum (C#)
// Title: An exhaustive enum of all Windows System Error Codes
// Source: https://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx
// Description: Error codes are a means to provide information to outside systems on why a program terminated. This list
// need not be included in its entirety. It is meant to aid in conforming to the existing error code usage.
// See this link form more information on usage. https://msdn.microsoft.com/en-us/library/system.environment.exitcode.aspx
// Note: Internet error codes are excluded from this list. See here: https://msdn.microsoft.com/en-us/library/windows/desktop/aa385465.aspx
// Updated: 2016/10/31
namespace Core
{
@weltkante
weltkante / ArrayBinder.cs
Created April 5, 2019 09:07
2d array wrapper for WPF datagrid binding
public sealed class ArrayBinder : IBindingList, ITypedList
{
private sealed class ArrayColumn : PropertyDescriptor
{
public ArrayBinder Owner { get; }
public int ColumnIndex { get; }
public ArrayColumn(ArrayBinder owner, int index)
: base($"[{index}]", null)
{
@aarani
aarani / ABIParser.cs
Created September 6, 2019 19:22
ABI DNA Chromatogram File Parser for C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace ABIParser
{
public class ABIParser
{
@sappho192
sappho192 / MainWindow.xaml
Created May 20, 2020 09:54
[WPF] WPF Webcam & Video player with OpenCVSharp4
<Window x:Class="WebcamCaptureApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WebcamCaptureApp"
mc:Ignorable="d"
Title="MainWindow" Height="900" Width="1600">
<Grid>
<StackPanel Orientation="Vertical">
@hans-jorg
hans-jorg / VSCODE-C.md
Last active February 13, 2024 02:03
VS Code for C Development including for Embedded Systems

Using VS Code for C development including for Embedded Systems

Contents

  • Introduction
  • Installation
  • Single C file project
  • A simple project with two C files
@jogboms
jogboms / main.dart
Created February 25, 2022 18:02
Circular mood picker
import 'dart:math' as math;
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
const primaryColor = Color(0xFF080B21);
import 'gpt_choice.dart';
import 'gpt_usage.dart';
import 'package:json_annotation/json_annotation.dart';
part 'gpt_message.g.dart';
@JsonSerializable(explicitToJson: true)
class GptMessage {
String id;
import 'gpt_choice_message.dart';
import 'package:json_annotation/json_annotation.dart';
part 'gpt_choice.g.dart';
@JsonSerializable(explicitToJson: true)
class GptChoice {
GptChoiceMessage message;
@JsonKey(name: 'finish_reason')
import 'package:json_annotation/json_annotation.dart';
part 'gpt_choice_message.g.dart';
@JsonSerializable(explicitToJson: true)
class GptChoiceMessage{
String role;
String content;