Skip to content

Instantly share code, notes, and snippets.

@sdebnath
sdebnath / keybindings.json
Last active December 4, 2023 19:57
VSCode Key Bindings
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+q",
"command": "editor.action.peekDefinition",
"when": "editorHasDefinitionProvider && editorTextFocus && !inReferenceSearchEditor && !isInEmbeddedEditor"
},
{
"key": "alt+f12",
"command": "-editor.action.peekDefinition",
@sdebnath
sdebnath / qsort.erl
Created March 15, 2015 22:38
Quicksort in Erlang
%%==============================================================================
%% Quicksort implementation in Erlang
%%
%% Author: Shawn Debnath
%%==============================================================================
%%----------------------------------------------------------------------
%% qsort_r/1
%%
%% Recursive quicksort
@sdebnath
sdebnath / genct.sh
Created July 11, 2015 23:50
generate cscope and tags for freebsd src
#!/bin/sh
# Copyright (c) 2015, Shawn Debnath. 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.
#
@sdebnath
sdebnath / firefox_disable_top_tab_bar.md
Last active November 28, 2022 00:22
Disable top tab bar in Firefox 90+

How to disable top tab bar in Firefox 107+ (Tested Nov 27, 2022)

Create custom userChrome.css

  1. Determine profile folder: Help > More troubleshooting information > Profile Folder
  2. Create a folder called chrome in the profile directory
  3. Create a file userChrome.css in the chrome directory with the following contents:
#TabsToolbar { visibility: collapse !important; }

This is an outdated draft that was used to review the content with FreeBSD contributors. For the latest revision, vist http://shawndebnath.com/articles/2016/03/27/freebsd-jails-with-vlan-howto.html.


FreeBSD Jails with VLAN HOWTO

This article discusses how to set up jails on a FreeBSD 11-CURRENT system utilizing VIMAGE (aka VNET) to provide a virtualized independent network stack for each jail with support for VLAN tagging.

Prerequisites

begin;
select mxact_create(:scale);
-- select mxact_create_and_select(:scale);
commit;
@sdebnath
sdebnath / mxact_create_and_select.sql
Last active January 20, 2022 05:41
Test workload for PostgreSQL MultiXact: create new mxact and select older
CREATE OR REPLACE FUNCTION mxact_create_and_select(SCALE integer) RETURNS void AS $body$
declare
default_rows_per_scale integer := 100000;
gap integer := 3000;
range integer := 100;
create_base_id integer;
read_base_id integer;
segment_id integer;
insert_timsetamp timestamp;
read_timestamp timestamp;
@sdebnath
sdebnath / mxact_create.sql
Last active January 20, 2022 05:41
Test workload for PostgreSQL MultiXact: create new mxacts
CREATE OR REPLACE FUNCTION mxact_create(SCALE integer) RETURNS void AS $body$
declare
default_rows_per_scale integer := 100000;
gap integer := 3000;
range integer := 100;
create_base_id integer;
segment_id integer;
begin
-- Generate a random number to use as a segment to offset concurrent connections from hitting the same exact range of ids
select (trunc(extract(millisecond from current_timestamp) * default_rows_per_scale, 0) % (100000 * scale)) into create_base_id;
@sdebnath
sdebnath / msort.erl
Created March 15, 2015 22:41
Mergesort in Erlang
%%==============================================================================
%% Mergesort implementation in Erlang
%%
%% Author: Shawn Debnath
%%==============================================================================
%%----------------------------------------------------------------------
%% msort/1
%%
%% Mergesort (recursive), implements split and merge.
@sdebnath
sdebnath / bridgegate.py
Created August 26, 2018 01:34
bridgegate.py
#!/usr/bin/env python
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN