Skip to content

Instantly share code, notes, and snippets.

View bojanrajkovic's full-sized avatar

Bojan Rajkovic bojanrajkovic

View GitHub Profile
/*
* Copyright (c) 1987, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
@bojanrajkovic
bojanrajkovic / option.cs
Last active March 14, 2024 20:13
Quick and dirty Rust-like Option<T> in C#. Basically untested, use at your own risk!
public static class Option
{
public static Option<T> None<T>() => new None<T>();
public static Option<T> Some<T>(T value) => new Some<T>(value);
}
public class Option<T> : IEquatable<Option<T>>
{
public static Option<T> None => new None<T>();
public bool IsNone => !hasValue;
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=80%, initial-scale=1, shrink-to-fit=yes">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=80%, initial-scale=1, shrink-to-fit=yes">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=80%, initial-scale=1, shrink-to-fit=yes">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/css/bootstrap.min.css"
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
{
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"name": "Annotations & Alerts",
@bojanrajkovic
bojanrajkovic / sounds.workbook
Created February 20, 2018 03:41
A workbook on generating sound
uti platforms
com.xamarin.workbook
Console

Generating sounds in C#

Sound is all around us—very few of us ever spend time in a totally quiet room. Similarly few of us ever consider what sounds are made up of. In this workbook, we’ll explore generating some simple tones, including a few different kinds of sound waves: square waves, sine waves, and triangle waves.

@bojanrajkovic
bojanrajkovic / chickencodec.cs
Created February 20, 2018 03:25
Chicken codec
using System;
using System.Text;
namespace CodeRinseRepeat.Chicken
{
public class ChickenCodec
{
static readonly Char [] FeedStock = { 'C', 'H', 'I', 'C', 'K', 'E', 'N', '.' };
public static Lazy<byte []> ChickenFeed = new Lazy<byte []> (SpreadFeed);
@bojanrajkovic
bojanrajkovic / cpbitmap.cs
Created February 20, 2018 03:22
CPBitmap Reader
using System;
using System.IO;
using System.Threading.Tasks;
namespace CodeRinseRepeat.CPBitmapReader
{
public sealed class CPBitmap
{
public int Width { get; set; }
public int Height { get; set; }