Skip to content

Instantly share code, notes, and snippets.

View BojoDimov's full-sized avatar
🎧
commiting

Божидар Димов BojoDimov

🎧
commiting
View GitHub Profile
@aisouard
aisouard / readVariableInt.js
Last active May 5, 2021 09:53
Reading an EBML variable-length integer
/**
* Read an EBML tag header or length and return their respective values into
* single numbers.
*
* @example
* var tagHeader = new Uint8Array([0x1A, 0x45, 0xDF, 0xA3, 0x01, 0x00, 0x00,
* 0x00, 0x00, 0x00, 0x00, 0x1F]);
* var tagId = readVariableInt(tagHeader, 4, 0);
* console.log('The current tag ID is: ', tagId.value, ', skipping ', tagId.size, ' bytes.');
* // The current tag ID is: 172351395, skipping 4 bytes.
@mattwhetton
mattwhetton / HttpsRedirectMiddleware.cs
Last active November 24, 2020 23:22
Simple OWIN middleware for doing an HTTPs redirect for all requests
// Ref: http://www.codenutz.com/https-redirect-asp-net-core-using-owin-middleware/
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Builder;
namespace SomeNamespace
{
public class HttpsRedirectMiddleware {
@NickSeagull
NickSeagull / ubuntu-bloat-removal.sh
Last active November 6, 2024 16:38
Updated Jan 22nd, 2024 - Simple command to remove all "bloatware" from ubuntu
sudo apt-get remove \
aisleriot \
brltty \
duplicity \
empathy \
empathy-common \
example-content \
gnome-accessibility-themes \
gnome-contacts \
gnome-mahjongg \
@charlesportwoodii
charlesportwoodii / HKDF.cs
Last active January 21, 2022 22:17
RFC 5869, HMAC-based Extract-and-Expand Key Derivation Function (HKDF) in C# for .Net Core
using System;
using System.Security.Cryptography;
class HKDF
{
public byte[] hash { get; set; }
private readonly HashAlgorithmName algorithm;
private readonly HMAC hmac;
private readonly int digestLength;
@caroso1222
caroso1222 / dom.service.ts
Last active August 18, 2023 13:34
Service to dynamically append Angular components to the body
import {
Injectable,
Injector,
ComponentFactoryResolver,
EmbeddedViewRef,
ApplicationRef
} from '@angular/core';
@Injectable()
export class DomService {