Skip to content

Instantly share code, notes, and snippets.

View dzmitry-lahoda's full-sized avatar

dzmitry-lahoda dzmitry-lahoda

View GitHub Profile
@CMCDragonkai
CMCDragonkai / nix_inputs.md
Last active May 26, 2025 05:48
Understanding Nix Inputs #nix

Understanding Nix Inputs

Every Nix derivation produces a Nix store output that has 3 things:

  • Executables
  • Libraries
  • Data

Executables are always exported using the PATH environment variable. This is pretty much automatic.

@andrewrk
andrewrk / 1-brute-force.c
Created May 1, 2019 21:58
cleanup code techniques
int main(int argc, char **argv) {
struct SoundIo *soundio = soundio_create();
if (!soundio) {
fprintf(stderr, "out of memory\n");
return 1;
}
int err;
if ((err = soundio_connect(soundio))) {
fprintf(stderr, "unable to connect: %s\n", soundio_strerror(err));
soundio_destroy(soundio);
@FaronBracy
FaronBracy / .editorconfig
Last active February 19, 2024 14:13
Editor config file for CSharp .cs files including Visual Studio and ReSharper custom attributes
#####################################################################################################
# 2019-01-15 Initial Creation
# 2019-04-01 Added ReSharper Settings
# 2019-05-16 Naming Rules Work With ReSharper
# 2019-07-09 Constant and Static Readonly Naming Rules
# 2022-09-16 New Settings for Visual Studio 2022
#####################################################################################################
# Based off of generic config from https://github.com/RehanSaeed/EditorConfig
# License MIT - https://github.com/RehanSaeed/EditorConfig/blob/master/LICENSE
#
@sakno
sakno / roslyn-tc-proposal.md
Last active March 25, 2019 16:28
Roslyin Compiler Support for Type Classes

Roslyin Compiler Support for Type Classes

This documentation describes potential implementation of Type Classes and Shapes features in Roslyn compiler.

Goals:

  1. Provide a solution without extra modification of .NET CLR
  2. Stay backward compatible so previous versions of C# programming language can use generic types constrained with type classes
  3. Stay CLS compliant
  4. Provide interoperability between different .NET languages
@dadhi
dadhi / Env.fsx
Created March 11, 2019 12:51
An F# toy example of Scala ZIO Environment
module EnvDemo
open System
open System.IO
[<Struct>]
type Nothing =
private
| Nothing
@bradtraversy
bradtraversy / vscode_shortcuts.md
Last active April 18, 2025 13:45
Helpful shortcuts for VSCode

VSCode Shortcuts

List of helpful shortcuts for faster coding

If you have any other helpful shortcuts, feel free to add in the comments of this gist :)

Official List of all commands

using System;
class Program
{
// M wants to get an instance via Func
static void M(Func<string> factory)
{
Console.WriteLine(factory());
}
@CMCDragonkai
CMCDragonkai / nix_ca_certificate_handling.md
Created October 16, 2018 07:02
Nix CA Certificate Handling #nix

Nix CA Certificate Handling

Some applications requires contacting HTTPS endpoints. In those cases you need to supply the CA certificates.

Most Nix applications won't package in the CA certificates, this is because they can make use of the OS provided CA certificate store.

The NixOS location for this is at: /etc/ssl/certs.

The OpenSSL library in Nixpkgs is compiled to use that path if there is no environment variables such as SSL_CERT_FILE.

@grenzi
grenzi / Set-PsEnv.psm1
Last active February 21, 2023 23:11
sets powershell environment variables from python-dotenv formatted .env file
<#
.Synopsis
Exports environment variable from the .env file to the current process.
.Description
This function looks for .env file in the current directoty, if present
it loads the environment variable mentioned in the file to the current process.
based on https://github.com/rajivharris/Set-PsEnv
@eulerfx
eulerfx / Async.Race.fs
Created June 21, 2018 20:58
F# Async Race
let race (a:Async<'a>) (b:Async<'a>) : Async<'a * Async<'a>> = async {
return!
Async.FromContinuations <| fun (ok,err,cnc) ->
let state = ref 0
let iv = new TaskCompletionSource<_>()
let ok a =
if (Interlocked.CompareExchange(state, 1, 0) = 0) then
ok (a, iv.Task |> Async.AwaitTask)
else
iv.SetResult a